|
|||||||||
|
|
|||||||||
| 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 input function of a do-sgml-parse or do-xml-parse, or any function or find rule invoked from the input 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 test-out
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 stream in-data
as
open test-out as file "story.xml"
using output as #markup-parser and test-out
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
close test-out
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.
| ---- |