swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
built-in variable  

#markup-parser

 
 

Purpose

A built-in stream used to send the input to the markup parser. Values written to it are passed to the active parser (SGML or XML).

The #markup-parser stream is only available when the program controls the delivery of the XML or SGML markup text to the markup parser. Doing so is most common in the string source function of a do-sgml-parse or do-xml-parse, or any function or find rule invoked from the string source function.

#markup-parser can also be used in external-text-entity rules.

This program takes the data in in-doc and processes it to create the xml document, story.xml. The XML document is validated as it is created.


  
    global stream in-doc initial
          {"title: My School Project%n"
        || "author: Johnny Smith%n"
        || "Eggs are good for you. They taste good, too.%n"
        || "Eggs are messy. They break when you drop them.%n"
           }
  
    define function get-stuff value string in-data
    as
        
        using output as #markup-parser and file "story.xml"
        do
          output "<!doctype story [%n"
              || "<!element story - - (title, author, p+)>%n"
              || "<!element (title|author|p) - - (#pcdata)>%n"
              || "]>%n"
              || "<story>%n"
  
          submit in-data
          output "</story>"
        done
        
   find "title:" any-text+ => TitleText
      output "<title>" || TitleText || "</title>%n"
          
   find "author:" any-text+ => AuthorText
      output "<author>" || AuthorText || "</author>%n"
      
   find any-text+ =>ParaText
      output "<p>" || ParaText || "</p>"
      
    process
      do sgml-parse document scan input get-stuff in-doc
         suppress
      done
      
    element #implied
      suppress  

You cannot open or close the #markup-parser stream.

In context-translations or up-translations, #markup-parser can also be used in find-start and find-end rules.

In earlier releases of OmniMark, #markup-parser was identified as the #sgml stream. This form is still valid, but its use is deprecated.

  Related Syntax
   external-text-entity
   find
   find-end
   find-start
   sgml-error
   do sgml-parse
 
Related Concepts
   SGML record boundaries
   XML/SGML parsing: built-in shelves
 
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:33:48 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.