Java & XML

Posted on 2006-05-22
Last Modified: 2010-03-31
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:Body>
- <SimpleUesrTokenRequiredResponse xmlns="">
- <SimpleUesrTokenRequiredResult>
  <Message>inputString: foo</Message>
Question by:komlaaa
    LVL 23

    Assisted Solution


    you can use this...but there are lot of methodologies to do that...

    LVL 14

    Assisted Solution

    by:Tommy Braas
    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

    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.
    LVL 12

    Accepted Solution

    Some example on using XPath here:

    Bye, Giant.
    LVL 14

    Expert Comment

    by:Tommy Braas

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    If you have upgraded to Java2 update 10 on a Microsoft Windows client, you may have discovered that your Java application does not work as it did before.  For example, the colors of your Java2D graphic may be all wrong for no apparent reason. Aft…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now