File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
XML and Related Technologies
Xpath with name space?
Joined: Sep 25, 2008
Jan 13, 2010 12:43:53
I have the following xml:
<abc xmlns = "abc123"> <def1> </def1> <def2> </def2> </abc>
I need to access to the "def1" node. The xpath abc/def1 is not right. What should I include in side the xpath for the namespace?
Joined: Oct 14, 2005
Jan 13, 2010 13:21:20
there isn't any way to refer to elements in the default namespace. But if you have a way of providing a namespace context to your
expression, then do this:
(1) Provide a namespace context that maps your namespace URI ("abc123" in this case) to a prefix, let's say "x" for example.
(2) Write your
expression as "x:abc/x:def1".
I agree. Here's the link:
subject: Xpath with name space?
Questions on Requirements for Assignment..
Populating JList in Parent window from Child window's save button
problem with code....
Problem with xPath
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013