built-in shelf
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 by the string
source function.
The external-text-entity rules can also use #markup-parser.
This program takes the data in global variable in-doc and processes it to create an 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 nor close the #markup-parser stream.
In context-translate or up-translate programs, #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 allowed, but its use is deprecated.