what is the diff. between DOM and SAX ?

Answer Posted / csawant

Dom: (Tree-based)
This maps an XML document into an internal tree structure,
then allow an application to navigate that tree.

Tree-based APIs are useful for a wide range of
applications, but they normally put a great strain on
system resources, especially if the document is large.
Furthermore, many applications need to build their own
strongly typed data structures rather than using a generic
tree corresponding to an XML document. It is inefficient to
build a tree of parse nodes, only to map it onto a new data
structure and then discard the original.

SAX:(Event-based), SAX on the other hand, reports parsing
events (such as the start and end of elements) directly to
the application through callbacks, and does not usually
build an internal tree. The application implements handlers
to deal with the different events, much like handling
events in a graphical user interface.

In both of those cases, an event-based API provides a
simpler, lower-level access to an XML document: you can
parse documents much larger than your available system
memory, and you can construct your own data structures
using your callback event handlers.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is my rss feed?

456


How is xml parsed?

449


What are the differences between HTML and XML?

485


Does xml support user-defined tags?

477


What is meant by xslt?

460






Is rss still used?

436


How does rss work?

447


What is XPATH? What is the use of it in XML?

471


Is xsl and xslt the same?

448


Where do I find my rss feed url on wordpress?

459


What is the icon for atom syndication?

459


What is XmlReader class? Explain.

480


How do I create an xml file on a mac?

461


What is an xml instance?

536


Can I use the getattribute() and setattribute() methods of version 2.2 of the java servlet api to parse xml documents?

507