Wednesday, January 12, 2011

XML Parsing Techniques

Parsing is a process that involves break the xml text into nodes.

Pull Parsing:

Application has to pull the next node or element from the parser. Application asks the parse to next node. Pull parsing does not do varification (checking the xml against schema) however definitely do verification.

Push Parsing:

Parser sends the notification to the application about the type of XML nodes / pieces found during parsing. It is also knows as Event Based Parsing. SAX (Simple API for XML) is fast parsing mechnism, but application has to match the speed of the SAX parser for each event. Same as above about validation and verification.

One Step Parsing:

Parser generates the tree based upon the XML document structure. DOM (Docuemnt Object Model) is one of the parsing standard. Very useful when traversing is required in the tree.

Hybrid Parsing:

The application thinks its working with one step parser that has processed the whole document while parsing process has just started. As the pplication keeps accessing more objects on the DOM tree the parsing continues incrementally.

XML Parsing Models and Their Trade-Offs:


ModelControl of ParsingControl of ContextMemory EfficiencyComputational EfficinecySimplicity
PullApplicationApplicationHigh Highest Low
Push (SAX) Parser Application High High Low
One-step(DOM) Parser Parser Lowest Lowest High
One-step (JDOM) Parser Parser Low Low Highest
Hybrid (DOM) Parser Parser Medium Medium High
Hybrid (JDOM) Parser Parser Medium Medium Highest


References:
http://media.techtarget.com/searchSAP/downloads/Building_Web_Services_with_Java_CH02.pdf

No comments:

Post a Comment