Skip to Content
avatar image
Former Member

Where does DOM and SAX parser comes in picture....

Hi,

I came to know that there are two kind of parsers used for java mapping:

DOM and SAX.

Now, I am just wondering what is this parser and how does it come into picture.

Lets say I have soyrce message types

first name and last name

Now I want to concatenate this two for target mesage (I know we can use standard function to map this but I am taking this simple example for understanding purpose) then I can just write small java function in java editor in mapping screen.

<b>Where does DOM and SAX parser come in picture ?</b>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 30, 2006 at 01:45 AM

    Hi tushar,

    The user defined functions that you write in your Graphical Mapping has nothing to do with Java Mapping.

    In your Graphical Mapping, the parsing of source structure is handled interannly by XI.

    But, when you go for an explicit mapping technique like Java Mapping, you have to parse the source XML structure, so that you can write the logic for your mapping.

    Java Mapping will execute a method called Execute, that will take the source XML structure as the Input Stream and then, you have to parse the Input STream and to do this parsing, you use SAX or DOM parser.

    DOM processor loads the entire XML into the memory and is processor intenseive, SAX does it element by element and so is not processor intensive.

    Hope this info helps,

    Regards,

    Bhavesh

    Add comment
    10|10000 characters needed characters exceeded

    • hi tushar,

      you can create your java mapping code in any Java editor.

      Create a JAR file for your class, and then import it under IMPORTED ARCHIVE in your Integraton Repository and just use it in your Inteface Mapping.

      Hope this helps

      Regards.

      Bhavesh

  • Mar 30, 2006 at 02:27 AM

    Hi Tushar,

    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.

    <b>On how to create XML docs with SAX and DOM go thruugh these links:</b>

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

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

    Regards,

    Chandra

    Add comment
    10|10000 characters needed characters exceeded