Skip to Content
avatar image
Former Member

Parsers

What is DOM and SAX Parser. Advantages and Disadvantages?????

Ruchitha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 31, 2007 at 12:44 PM

    Hi ruchitha thakur ,

    These r all the details regarding DOM & SAX & their advantages & disadvantages:

    Java Mapping using DOM Parser

    In Java Mapping, we ourselves have to write the code to manipulate the incoming xml messages, parse it and to create the outbound xml message. while generating XML is a straightforward procedure, the inverse operation, using XML data from within a program, is not. To our assistance, there are some java based xml parsers available which will ease the task of xml manipulation.

    There are mainly two popular XML parsing standards.

    SAX API

    DOM API

    DOM:

    XML parsers that implement DOM create a tree in memory that represents the contents of the XML document.

    Drawbacks:

    Huge Memory:

    It loads the entire XML document into memory. For large documents, this becomes a problem. Again, since the DOM is implemented as many tiny objects, the memory footprint is even larger than the XML document itself because the JVM stores a few extra bytes of information regarding all of these objects, as well as the contents of the XML document.

    Processor Intensive:

    Another subtle issue for the DOM API is that code written for it must scan the XML document twice. The first pass creates the DOM structure in memory, the second locates all XML data the program is interested in.

    Coming to DOM standard, there are several implementations available by different vendors.

    The following web-sites give u all information about DOM & SAX:

    Document Object Model (DOM)(In this web-site u wil get all details about DOM)

    http://www.w3.org/DOM/

    Simple API for XML(In this web-site u wil get all details about SAX)

    http://sax.sourceforge.net/

    Java Mapping using DOM Parser

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/main&

    Java Mapping Sample Code

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/main&

    http://www.sap-hefte.de/download/dateien/1241/140_leseprobe.pdf

    cheers!

    gyanaraj

    *****Pls reward points if u find this informative

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 31, 2007 at 11:25 AM

    Ruchita,

    Before you post any further threads, read the Rules of Engagement.

    All your questions can be found using a simple search. Refrain from spamming the forums.

    Regards,

    Jai Shankar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 31, 2007 at 11:28 AM

    <b>What is DOM and SAX Parser</b>

    these are the 2 parsers JAVA uses for parsing the messages.

    see here...

    For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/

    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html

    tutorial sax and dom

    /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs

    SAX AND dom PARSER ( BY thorsten)

    /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs

    see here the code for JAVA mapping

    Refer these links...

    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm

    /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs

    /people/swaroopa.vishwanath/blog/2005/06/29/generic-approach-for-validating-incoming-flat-file-in-sap-xi--part-ii

    regards

    biplab

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 31, 2007 at 11:40 AM

    hi ruchitha,

    you can find all about DOM and SAX Parsers in the following links

    http://www.w3schools.com

    Add comment
    10|10000 characters needed characters exceeded