cancel
Showing results for 
Search instead for 
Did you mean: 

How to Parse XML from RFC Response

former_member182004
Contributor
0 Kudos

Hello Folks!

I need your help for this topic:

I used the code posted by Michal on:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1...

Everything works fine, but I have some problems to get the value that I want, I mean, parsing the resulting XML to get the tag that matters for me.

Searching on the Internet, I found some pieces of code and I could make it work in Sap Developer Studio, making a Class that has a method with 2 parameters: the Response XML (in String format), and the tag that has to be found.

When I exported the .jar to upload it to XI and use it like as an UDF, it shows me an error:

" The message is: Exception:[java.lang.NoClassDefFoundError: org/apache/xerces/parsers/AbstractDOMParser "

In my class on the IDE I imported:


import java.io.StringReader;
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

And in the UDF I imported:

org.w3c.dom.*;

com.ibm.xi.mapping.udf.*;

java.io.StringReader;

org.xml.sax.InputSource;

I can see that there are some classes missing on the PI server... I tried to upload the .jar that contains them, but the xml.jar is huge (6 MB).

Is there any way to just upload those classes? Or another way to do the parse?

Thanks in advance!!

Juan

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

You cannot use org.apache.xerxes

Use sapxmltoolkit for 7.0 or the standard XML parser of the JDK in 7.1

Regards

Stefan

Answers (2)

Answers (2)

former_member182004
Contributor
0 Kudos

Thanx Stefan and Satish,

I solved the XML parsing with the Bhavesh's explanation.

Former Member
0 Kudos

Juan,

Please check bhavesh response and his blog in this thread:

Regards,

---Satish