File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Setting Xpath String to do XPath query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Setting Xpath String to do XPath query" Watch "Setting Xpath String to do XPath query" New topic
Author

Setting Xpath String to do XPath query

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

OK so I am trying to do an XPath query to get the value of some tag.

Here is the basic information.

XML Document



I really shortened it.

This is what I am calling to get the DOMValue

So contextNode is the Node Object for the Header tag.
xPath should be the xPath String.



In order to get the Reference Number value of 111222333 from the Reference Number tag, what is the xPath string that I need? I can then figure out what I need for all my other tags in the xml document.

Thanks

Mark

[ October 26, 2005: Message edited by: Mark Spritzler ]
[ October 26, 2005: Message edited by: Mark Spritzler ]

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by James Swan:


Thanks, but what if there is also a namespace?

Mark
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Ahh, didn't see that part of your question.
What happens when you run the above code against your XML file and schema?
[ October 30, 2005: Message edited by: James Swan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting Xpath String to do XPath query