Define validating parser

XSLT and XPath, for example, need to be able to access any node at any time in the parsed XML tree.

A parser that implements SAX (i.e., a SAX Parser) functions as a stream parser, with an event-driven API.

building the full AST of an XML document for convenience of the user, SAX parsers operate on each piece of the XML document sequentially, issuing parsing events while making a single pass A SAX parser only needs to report each parsing event as it happens, and normally discards almost all of that information once reported (it does, however, keep some things, for example a list of all elements that have not been closed yet, in order to catch later errors such as end-tags in the wrong order).

Thus, the minimum memory required for a SAX parser is proportional to the maximum depth of the XML file (i.e., of the XML tree) and the maximum data involved in a single XML event (such as the name and attributes of a single start-tag, or the content of a processing instruction, etc.). A DOM parser, in contrast, has to build a tree representation of the entire document in memory to begin with, thus using memory that increases with the entire document length.

The most trivial example is that an attribute declared in the DTD to be of type IDREF, requires that there be only one element in the document that uses the same value for an ID attribute.

To validate this in a SAX parser, one must keep track of all ID attributes (any one of them might end up being referenced by an IDREF attribute at the very end); as well as every IDREF attribute until it is resolved.

Search for define validating parser:

define validating parser-68define validating parser-50define validating parser-3

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “define validating parser”