File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes differences between DOM and SAX parsers? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "differences between DOM and SAX parsers?" Watch "differences between DOM and SAX parsers?" New topic
Author

differences between DOM and SAX parsers?

yekkala krishna
Ranch Hand

Joined: Mar 04, 2007
Posts: 105
hi,

I want to know clear differences between DOM and SAX parsers.please suggest your ideas regarding this concept.

with regards,
Y.Rama Krishna
mahudees waran
Greenhorn

Joined: Dec 17, 2006
Posts: 28
Simple API for XML (SAX) or the Document Object Model (DOM). Both of these parsers are provided by Java API for XML Processing (JAXP). Java developers can invoke a SAX or DOM parser in an application through the JAXP API to parse an XML document that is, scan the document and logically break it up into discrete pieces. The parsed content is then made available to the application. In the SAX approach, the parser starts at the beginning of the document and passes each piece of the document to the application in the sequence it finds it. Nothing is saved in memory.

The application can take action on the data as it gets it from the parser, but it can't do any in-memory manipulation of the data. For example, it can't update the data in memory and return the updated data to the XML file.

In the DOM approach, the parser creates a tree of objects that represents the content and organization of data in the document. In this case, the tree exists in memory. The application can then navigate through the tree to access the data it needs, and if appropriate, manipulate it.

for more details goto [URL=http://java.sun.com/developer/technicalArticles/WebServices/jaxb/#binsch]http://java.sun.com/developer/technicalArticles/WebServices/jaxb/#binsch[/url]
[ August 02, 2007: Message edited by: mahudees waran ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: differences between DOM and SAX parsers?