Instead, they are integrated into the streaming model of Omni Mark.In general terms, any program that reads a data stream and analyzes it to reveal its structure is a parser.Then it attempts to recover and continue parsing the input the best it can.
XML and SGML parsers perform three basic functions: This behavior is appropriate in all cases in which you are attempting to interpret the XML or SGML document based on its structure and content.
If you want to process an XML or SGML document in another way (for example, to programmatically edit existing XML or SGML documents) it may be appropriate to write your own parsing routine using scanning techniques.
Because they are part of the language, the parsers do not use a parser interface like DOM or SAX.
Instead, they are integrated into the streaming model of Omni Mark. In general terms, any program that reads a data stream and analyzes it to reveal its structure is a parser.
This is particularly valuable when you are translating data into XML or SGML and want to use the parser to verify the structure of the output document.
It is also a useful way to do certain kinds of processing by first normalizing the data to XML or SGML format and then processing the normalized data.The result of parsing is thus a stream of data content and markup events; it can be either accessed unprocessed as .In the latter case, you write code in the body of the markup rules to respond to the reported structure of the document.The most obvious way to process a document by scanning and then parsing is to stream scanning output to a buffer or a file and then to parse the file or buffer.However, this approach is resource intensive and can be slow.You can also configure the parsers for DTD or schema validation, or you can separately validate the markup stream that's produced by the parser.When the parser encounters invalid input it inserts a markup error event into the markup stream.Almost all Omni Mark programs are parsers in this sense.XML and SGML parsers perform a specific and formal kind of parsing that corresponds to the requirements of the XML and SGML specifications respectively.You can avoid buffering the intermediate form by feeding the output of the scanning process directly to the parser.That is, the output scope of the scanning process becomes the input source of the parsing operation.