DOM & SAX parsers explanation and difference ?

Answers were Sorted based on User's Feedback



DOM & SAX parsers explanation and difference ?..

Answer / harish

DOM Parser is nothing but, Document Object Model Parser, It
loads the entire XML file into the primary memory and
represents in a Tree structured manner. It traverses from
Root Node to Child Node.
SAX Parser is nothing but, Simple API for XML. It is event
driven based parser. It traverse node by node in a
sequential order. It won?t load the entire xml file into
the memory. If it is small xml file, better go for DOM
Parser. If it huge xml file, better go for SAX Parser.

Is This Answer Correct ?    52 Yes 5 No

DOM & SAX parsers explanation and difference ?..

Answer / sangeri

DOM parser

1.In DOM parser the representation is in the memory as it
is used for the internal representation of an
XML document.
2.It reads the whole document and returns a DOM tree
representation of the
XML document.
3.So for smaller xml we can use DOM as memory is the
constraint.

SAX parser

1.It is event driven
2.It works incrementally and generates events that are
passed to the application.
3.For huge
XML we can go for SAX rather than DOM
4.It does not give any structural representation for the
XML document.

So depending on the application you develop you can choose
any of the parser

Is This Answer Correct ?    31 Yes 6 No

DOM & SAX parsers explanation and difference ?..

Answer / smitha shanbhag

in DOM we can update the things,
whereas in SAX we can't update the things.

Is This Answer Correct ?    12 Yes 0 No

DOM & SAX parsers explanation and difference ?..

Answer / ramu

sax is faster than dom

Is This Answer Correct ?    11 Yes 2 No

DOM & SAX parsers explanation and difference ?..

Answer / gopi

SAX is top to bottom traversal as it parse node by node

DOM traverse in any direction because the whole XML while
gets loaded into the memory.

Is This Answer Correct ?    1 Yes 1 No

DOM & SAX parsers explanation and difference ?..

Answer / ashish jayaswal

DOM is top to bottom traversal as it parse node by node

SAX traverse in any direction because the whole XML while
gets loaded into the memory.

And thats why SAX is faster than DOM.

Is This Answer Correct ?    3 Yes 16 No

Post New Answer

More XML XSLT RSS Interview Questions

What is the usage of xslt?

0 Answers  


Explain how we compare xslt and xpath?

0 Answers  


How do I subscribe to rss feeds in chrome?

0 Answers  


How does xml handle white-space in my documents?

0 Answers  


How do I open an xml file in excel?

0 Answers  






What is the difference between xml dtd and xml schema or xsd?

0 Answers  


What are DOM and SAX ?

1 Answers  


Is wsdl and xsd same?

0 Answers  


What happens when firefox knows a web page has atom feeds?

0 Answers  


What is the full form of xml?

0 Answers  


Can I resolve the uri used as an xml namespace name?

0 Answers  


Is xml a nosql?

0 Answers  


Categories