cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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>

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member91687
Active Contributor
0 Kudos

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

bhavesh_kantilal
Active Contributor
0 Kudos

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

bhavesh_kantilal
Active Contributor
0 Kudos

hi tushar,

for further info, just check these links,

If you are using SAX parser, there are 5 methods . They are 1) Start of the document(startDocument)

2) start of the element(startElement)

3) end of the element(endElement)

4) end of the document(endDocument)

5) chars()

Also check with any java site about SAX events how it works etc.

<b>Java Mapping

</b>

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

<b>DOM parser API

</b>

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

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Where and how can I do Java mapping ?

Do I need to use external netbeeans kind of editor and import the code in XI ?

Thanks.

moorthy
Active Contributor
0 Kudos

Hi,

You can do Java Mapping in the NetWeaver Developer Studio(NDS).

But you need to import some of the Jar files etc. Once you done the Mapping , you need to export it and import into Repository->Imoprted Archives .

<i>****Do I need to use external netbeeans kind of editor and import the code in XI ?</i>

You need to have just Jar files to import into XI.

Here it goes-

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

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

Hope this helps.

Regards,

Moorthy

bhavesh_kantilal
Active Contributor
0 Kudos

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