cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Empty Attribute Using Java Mapping

Former Member
0 Kudos

hi,

I am Parsing source xml using SAX PARSER in JAVA MAPPING i am adding attribute to the root element but it is adding same attribute to the root as well as child also.

this is my sender structure

<Books>

<Book attribute="value">

<Title>title</Title>

<Author>

<First_Name>fname</First_Name>

<Last_Name>lname</Last_Name>

</Author>

<Price>100</Price>

</Book>

</Books>

TARGET STRUCTURE I AM GETTING IS

<Books>

<b><Book xmlns=""></b>

<attribute>value</attribute>

<Title>title</Title>

<Author_Name>fnamelname</Author_Name>

<Price>100</Price>

</Book>

</Books>

TARGET I NEED IS

<Books>

<b><Book></b>

<attribute>value</attribute>

<Title>title</Title>

<Author_Name>fnamelname</Author_Name>

<Price>100</Price>

</Book>

</Book>

u can see the diff is am getting an extra attribute created for me which i dont need.

Accepted Solutions (0)

Answers (2)

Answers (2)

VijayKonam
Active Contributor
0 Kudos

You must use appropriate function call in the SAX parser API. Seems like you are using create node or element. Instead of this, check for a function which creates an attribute. Did not know this for sure, but logically thinking, the member function used to create and element must be different from attribute or you might have an optional parameter in the same function for specifying the attribute.

VJ

moorthy
Active Contributor
0 Kudos

Hi,

Did u try running this ? Did it give error during runtime in XI ?? Check it...I think it may not give error

Also where are u generating target structure ..in end of document or for each element.. just to ask..

rgds,

Moorthy