File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes namespace confusion with xPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "namespace confusion with xPath" Watch "namespace confusion with xPath" New topic

namespace confusion with xPath

Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
How to handle namespace in xPath with following excerpt. I am quite confused.
Here is the XPath statement:

Here are different versions of xml file with indication wheter it works or not:
Vs. 1: without namespace in root-element document and without Doctype. Works (gives return noteset and true.

Vs. 2: with namespace in document and without Doctype. Does not work. (gives return null/false).

Here's question: How should I change the xPath statement that it works with this kind of implicit/anonymous namespace (not correct name), you know that xmlns='' stuff.

regards Axel
[ October 22, 2003: Message edited by: Axel Janssen ]
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
This FAQ with two examples might help:
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Thanks a lot.
Good luck in your job search.
I agree. Here's the link:
subject: namespace confusion with xPath
It's not a secret anymore!