Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

Java & XML

Hi,
i am working with SOAP and i have the methode below returning an XML. I would want to be able to grab an element in that XML and check what it is, how can i do that?

ret = baseServiceAxisImpl.handleResponse( call, new Object[] { params } );

================ Sample XML returned =========
.....
</soap:Header>
- <soap:Body>
- <SimpleUesrTokenRequiredResponse xmlns="http://dominica.com/WebServices/BAL">
- <SimpleUesrTokenRequiredResult>
  <Success>true</Success>
  <Message>inputString: foo</Message>
  </SimpleUesrTokenRequiredResult>
  </SimpleUesrTokenRequiredResponse>
  </soap:Body>
  </soap:Envelope>
  </log>
0
komlaaa
Asked:
komlaaa
  • 2
3 Solutions
 
rama_krishna580Commented:
Hi,

you can use this...but there are lot of methodologies to do that...
http://javaboutique.internet.com/reviews/xml_javabeans/

R.K
0
 
Tommy BraasCommented:
Two other options would be to;
1. "Manually" search for the start and end tags of the data you're looking for
2. Use the built in XML parser http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/package-summary.html

For instance:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
Document document = documentBuilder.parse(yourInputGoesHere);

You can now look for your data.

Another option is to use XPath, also included with the latest JDK.
0
 
Giant2Commented:
Some example on using XPath here:
http://javaalmanac.com/egs/org.w3c.dom/pkg.html#XPath

Bye, Giant.
0
 
Tommy BraasCommented:
;-D
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now