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
Win a copy of
this week in the
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
In plain XPath 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 XPath 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 XPath expression as "x:abc/x:def1".
rocket mass heater
subject: Xpath with name space?
Problem with xPath
Questions on Requirements for Assignment..
problem with code....
Populating JList in Parent window from Child window's save button
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014