|
|||||
|
|||||
Related Concepts | |||||
control structure |
do markup-parse |
Syntax
do markup-parse markup-parser-function-call local-delcaration* action* done
You can use do markup-parse
to parse a document using an external parser instead of OmniMark's built-in parser. This is useful if you wish to use a parser that has features not supported by OmniMark's built in parsers, such as support for XML Schema validation.
do markup-parse
is intended as a fully general interface to external parsers of all kinds and is not limited specifically to XML and SGML parsers. In this release of OmniMark, only Xerces from the Apache project, and the RTF external parser are supported.
do markup-parse
operates in the same way as do sgml-parse
or do xml-parse
except that the call to an external parser function takes the place of the normal parameters of xml-parse
or sgml-parse
invocation. The parameters of the external parser call may mirror some of the parameters of do xml-parse
, particularly the scan
parameter, however, the parameters of the external parser function are particular to the individual parser interface and its capabilities. In the sample below, xml
is the name of the external parser function and scan
is a parameter of that function. Consult the OMXERCES library documentation for complete details on the parameters of the xml
function.
import "omxerces.xmd" unprefixed process do markup-parse xml scan file "my.xml" output "%c" done
Following the invocation of a markup parse OmniMark markup rules are fired as when using an internal parser. Note however that OmniMark can only supply the information provided by the external parser, so you may not get the same information in all cases that you would have received from the internal parser.
Note in particular that the XML and SGML error numbers reported by OmniMark's internal parsers are a product of those parsers and will not be returned by an external parser. The error number reported by a markup error rule fired by an external parser will always be "0297". You will need to parse the error text to discover the specific error reported by the parser.
Related Concepts Input functions and the markup parser |