Hi Experts,
I am new to Java mapping and i have followed the link
http://scn.sap.com/thread/3173071 and it is working fine. It is for only one item. I have tried to modify the code and i placed a for loop to go create the Output Node based on the No of Input Nodes and it is giving the error as below. But my requirement is
Input.xml : -
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:DT_Source xmlns:ns0="urn:java_mapping2">
<Person1>
<Name>Alex</Name>
<Surname>Stewart</Surname>
</Person1>
<Person1>
<Name>Sam</Name>
<Surname>Abdreson</Surname>
</Person1>
</ns0:DT_Source>
Output.xml:-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ns0:DT_Target xmlns:ns0="urn:java_mapping2">
<Person2>
<EmpName>
<Emp>Alex Stewart</Emp>
</EmpName>
</Person2>
<Person2>
<EmpName>
<Emp>Sam Abdreson</Emp>
</EmpName>
</Person2>
</ns0:DT_Target>
I am unable to get the output. I am getting the following error.
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore()
at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild()
Please suggest me how i can resolvoe this error.
Regards,
GIRIDHAR