Skip to Content
avatar image
Former Member

SAX and DOM

Hi Everybody,

I have seen people telling that SAX and DOM are necessary for XI. Whay do we need it in XI?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jan 11, 2007 at 01:48 AM

    SAX and DOM are Parsers , tht are used to parse the xml document,,

    when you use java mapping ...... u need to first parse the incoming message into xi by using any of these parsing techniques.....then u can alter the parsed xml schema...according to the required target structure ,,,

    DOM parser is also used in Abap mapping

    Regards,

    Sushil Hadge

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 11, 2007 at 03:06 AM

    SAX and DOM are different APIs,SAX models the parser, DOM models the XML document. SAX programs can be much faster than their DOM equivalents, and almost always use far less memory.SAX works extremely well when documents are streamed, and the individual parts of each document can be processed in isolation from other parts.

    You use SAX when, you have huge docs, when the entire doc is not availabe and processing can be done in chunks of input, processin can be divided into into a chain of successive operations.

    DOM is used when, the program needs to access widely separated parts of the document at the same time or has to access multiple documents at the same time, The internal data structures complicated,or it might be required that the program must modify the document repeatedly or the program must store the document for a significant amount of time through many method calls.

    On how to create XML docs with SAX and DOM go thruugh these links:

    http://www.cafeconleche.org/books/xmljava/chapters/ch09.html

    http://www.cafeconleche.org/books/xmljava/chapters/ch06.html

    this information was shared by Chandra in one thread.

    Thanks,

    Pooja

    null

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 11, 2007 at 03:09 AM

    Hi,

    When you do the mapping using Java mapping, you would require to parse the source XML, this is where SAX and DOM parsers would be used.

    You have the execute method when you go for Java mapping, where the source structure is taken as an input stream, and then this has to be parsed, and this is done using SAX or DOM.

    Each has its own advantages and disadvantages, have a look at this:

    http://developerlife.com/saxvsdom/default.htm

    Some blogs on java mapping:

    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

    Regards,

    Chandra

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 11, 2007 at 03:17 AM

    Sonia,

    Just adding to the discussion here, Message Mapping / Graphical Mapping internally ses SAX parser to parse the XML.

    SAX parser is a memoryless parser and is recommened when the XML strucutre is huge. DOM parser loads the entire XML into the memory and so when the XML size is to big, DOM parser is to be avoided.

    Regards

    Bhavesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 11, 2007 at 05:19 AM

    Hi Sonia,

    Adding to above discussion,here i mentioned below how you would use java mapping, so you can be more familiar with the whole concept of java mapping.

    Java Mapping is one of the mapping techinuqe which xi supports,

    There are few steps which you need to follow while doing java mapping.

    Steps:

    1)you need to use any parsing Technique either DOM Or SAX.

    2)Develop your java class with out main method in Netweaver Developer stdio.

    3)Need to create a jar file in the Cmd(commond line promot.

    Commond for creation of jar cf name.jar filename.class

    4)import your jar file in to IR.you can see Imported Objects under software component.Right click on the Imported Object and select New and enter the name and browse your jar file and select the corresponding jar file which you created and click save and activate.

    5)when you are doing Interface Mapping you need to select as Java calass and select the Mapping program and after the process is same as normal.

    If you have any doubts please let me know I can very welcome to receive your queries.

    Thanks and Regards,

    Sekhar

    Add comment
    10|10000 characters needed characters exceeded