swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
Functions       Platforms  
 

Rich Text Format (RTF) (OMRTF)

 
 

You can use the RTF parser library to parse an RTF document. Like an XML document, an RTF document consists of markup and data content. The OmniMark RTF parser library maps the markup structures of RTF to OmniMarks markup rules according to the rules detailed below. When you use the RTF parser, you launch it just like an external XML parser, using do markup-parse and you access the structure and data content of the RTF file just as you would with an XML file -- by writing markup rules.

The following program illustrates the operation of the RTF parser by implementing a crude RTF to XML converter:

  import "omrtf.xmd" unprefixed
  process
    do markup-parse rtf
     scan file #args[1]
       output "%c"
    done
  
  element #implied
     output "<%q"
     repeat over attributes as a
        output " " || key of attribute a || '="%v(a)"'
     again
     output ">%c</%q>%n"
  
  translate "<"
     output "&lt;"
  translate ">"
     output "&gt;"
  translate "&"
     output "&amp;"

How RTF structures are mapped to markup rules

The only markup rules rules fired by the RTF parser are:

RTF commands are translated into XML-like elements, as follows:

RTF commands considered destinations

The OMRTF library is based on version 1.7 of the RTF spec, according to which, the RTF command names that are "destinations" are the following:

     aftncn
     aftnsep
     aftnsepc
     annotation
     atnauthor
     atndate
     atnicn
     atnid
     atnparent
     atnref
     atntime
     atrfend
     atrfstart
     author
     background
     bkmkend
     bkmkstart
     buptim
     category
     colortbl
     comment
     company
     creatim
     datafield
     do
     doccomm
     docvar
     dptxbxtext
     falt
     fchars
     ffdeftext
     ffentrymcr
     ffexitmcr
     ffformat
     ffhelptext
     ffl
     ffname
     ffstattext
     field
     file
     filetbl
     fldinst
     fldrslt
     fldtype
     fname
     fontemb
     fontfile
     fonttbl
     footer
     footerf
     footerl
     footerr
     footnote
     formfield
     ftncn
     ftnsep
     ftnsepc
     g
     generator
     gridtbl
     header
     headerf
     headerl
     headerr
     htmltag
     info
     keycode
     keywords
     lchars
     levelnumbers
     lfolevel
     list
     listlevel
     listname
     listoverride
     listoverridetable
     listpicture
     listtable
     listtext
     manager
     mhtmltag
     nesttableprops
     nextfile
     nonesttables
     objalias
     objclass
     objdata
     object
     objname
     objsect
     objtime
     oldcprops
     oldpprops
     oldsprops
     oldtprops
     operator
     panose
     pgp
     pgptbl
     picprop
     pict
     pn
     pnseclvl
     pntext
     pntxta
     pntxtb
     printim
     private
     pwd
     pxe
     result
     revtbl
     revtim
     rsidtbl
     rtf
     rxe
     shp
     shpinst
     shppict
     stylesheet
     subject
     tc
     template
     title
     txe
     ud
     upr
     urtf
     userprops
     xe

Functions
   omrtf-version
   rtf
 
Platforms
   HP/UX
   HP-UX Itanium 2
   IBM AIX 5.3
   IBM OS/2
   Linux (Intel)
   Linux Red Hat Enterprise 5
   MS Windows 98/ME
   MS Windows NT/2000/XP
   MS Windows Vista
   Sun Solaris 8
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: May 6, 2008 at 10:12:26 am
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.