Skip to Content
0
Former Member
Jun 28, 2007 at 10:41 PM

XML parsing in UDF

258 Views

Hi everyone!

First, I must say that I don't know anything about java/XML programming(I'm sorry)!

I'm just looking for some guiding lights for the following;

In the Message Mapping (IB), I'm trying to do a RFC Lookup to R/3 using a BAPI call. I followed Michal Krawczyk's "Mapping lookups - RFC API:

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

"

And now I need to parse the XML response and retrieve a value from it!

I would like to know if the following portion of code is ok and wheere should I put it?

Code:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

// Create DOM structure

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(content);

// Lets find my tag

NodeList list = document.getElementsByTagName("Number");

Node node = list.item(0);

if (node != null) {

node = node.getFirstChild();

}

if (node != null) {

tagValue = node.getNodeValue();

}

Thanks a lot for your help!