on 09-12-2013 9:26 AM
Dear All,
I have developed a Java Mapping program where I am parsing an incoming IDOC using the DOM parser. I found that the program works well for some message while it does not work for other. It does not throw any error but it does not return the correct data also.
As for example,
value of the field returned for correct parsing = 10976342
value of the field returned for in-correct parsing = #text
I also found that for some IDOC which is successfull and later when I download it from sxi_monitor and edit it in notepad - changing a value of a field from 100 to 200 and send the same message from "Send Test Message", it gives wrong output.
Your suggestion is welcome.
Thanks and Regards,
Rana Brata De
Hi,
did you debug the mapping in NWDS to see where the issue is ?
as it's probably not related to PI but to your coding,
Regards,
Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Michal,
The code is very simple : within a try-catch block I am writing
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
dbfactory.setNamespaceAware(true);
DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
Document doc = dbuilder.parse(in);
doc.getDocumentElement().normalize();
NodeList E1EDK02List = doc.getElementsByTagName("E1EDK02");
for(int i=0;i<E1EDK02List.getLength();i++)
{
String node_name = E1EDK02List.item(i).getFirstChild().getNodeName());
}
this line sometimes returns the node_name and sometime the #test
E1EDK02List.item(i).getFirstChild().getNodeName());
Hi Rana Brata,
Changing your code a little bit
{
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
dbfactory.setNamespaceAware(true);
DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
Document doc = dbuilder.parse(in);
doc.getDocumentElement().normalize();
Node temp;
NodeList E1EDK02List = doc.getElementsByTagName("E1EDK02");
for(int i=0;i<E1EDK02List.getLength();i++)
{
temp=E1EDK02List.item(i);
while(temp!=null && temp.getNodeType() != Node.ELEMENT_NODE){
temp=temp.getNextSibling();
}
if(temp!=null && temp.getNodeType() == Node.ELEMENT_NODE)
{
String node_name = temp.getNodeName());
}
}
Try this let's hope error disappears.
Regards
Anupam
Message was edited by: Anupam Ghosh
Hi Rana,
I am modifying the code a little bit
Please check if this works perfect.
{
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
dbfactory.setNamespaceAware(true);
DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
Document doc = dbuilder.parse(in);
doc.getDocumentElement().normalize();
Node temp;
NodeList E1EDK02List = doc.getElementsByTagName("E1EDK02");
for(int i=0;i<E1EDK02List.getLength();i++)
{
temp=E1EDK02List.item(i).getFirstChild();
while(temp!=null && temp.getNodeType() != Node.ELEMENT_NODE){
temp=temp.getNextSibling();
}
if(temp!=null && temp.getNodeType() == Node.ELEMENT_NODE)
{
String node_name = temp.getNodeName());
}
}
Regards
Anupam
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.