Validating saxparser

6854933580_2c8b688306_z

Additionally, some kinds of XML processing simply require having access to the entire document.

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

Many parsers, for example, return separate text events for numeric character references.

While a SAX parser may well be used to construct such a tree initially, SAX provides no help for such processing as a whole.Some implementations do not neatly fit either category: a DOM approach can keep its persistent data on disk, cleverly organized for speed (editors such as Soft Quad Author/Editor and large-document browser/indexers such as Dyna Text do this); while a SAX approach can cleverly cache information for later use (any validating SAX parser keeps more information than described above).Such implementations blur the DOM/SAX tradeoffs, but are often very effective in practice.The compensating advantage, of course, is that once loaded any part of the document can be accessed in any order.Because of the event-driven nature of SAX, processing documents is generally far faster than DOM-style parsers, so long as the processing can be done in a start-to-end pass.A parser that implements SAX (i.e., a SAX Parser) functions as a stream parser, with an event-driven API.

You must have an account to comment. Please register or login here!