I want to know the difference between the four above types (SAXPaser, XPath, DOM, XMLPullParse) and when should we use each one.
I want to know the difference between the four above types (SAXPaser, XPath, DOM,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SAX Parsing is the Best one to implement than DOM, see the difference between these two in the following:
DOM
The Nodes are in the form of Tree Structure
Memory: It Occupies more memory, DOM is only preffered in the case of small XML documents
Slower at runtime
Stored as an objects
Programmatically easy to implement
Ease of navigation and use.
SAX
Sequence of events
It doesn’t use any memory preferred for large documents.
Faster at runtime, because of the above mentioned point.
Objects are to be created.
Need to write code for creating objects
In SAX Backward navigation is not possible as it sequentially processes the document
So if you have very large files then you should use SAX parser since it will fire events and releasing them ,nothing is stored in memory ,and using SAX parser you can’t access element in a random way there is no going back ! , but Dom let you access any part of the xml file since it keeps the whole file/document in memory .
see this article and you can get what you want by reading the Summary.
also check this link to view performance of different xml parser