XPath with namespaces definitely works - i used it many times :)
make sure that XML parsed is with namespace aware builder mdoe set on?
and if it does nto help please post a full java file that can be executed to reproduce the error including what exactly XXP3 jar file you used.
thanks,
Alek
On 10/30/07, lipafrog <lipafrog@...> wrote:
Hi all,
I am using XPP3 to parse a document containing a custom namespace
and use an XPath predicate to pull out an element, but XPP3 does not
find the element! Without the namespace this example works fine, add
the namespace and it returns nothing. Have I failed to use XML
namespaces/XPP3 correctly? If so, could someone please point out how?
Thanks!
EG
The XML is like:
<ns1:A xmlns:ns1="http://some.url.org">
<ns1:B>
<ns1:C xyz="test"/>
</ns1:B>
</ns1:A>
The code I try to use looks like, and returns an empty ArrayList:
Xb1XPath predicateObj = new Xb1XPath("/ns1:A/ns1:B");
Object retObj = predicateObj.evaluate(docObj);
if (retObj != null) {
System.out.println(retObj.getClass().getName());
if (retObj instanceof ArrayList) {
System.out.println(((ArrayList) retObj).size());
}
} else
System.out.println("null");
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xmlpull-user/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/xmlpull-user/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:xmlpull-user-digest@yahoogroups.com
mailto: xmlpull-user-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
xmlpull-user-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
---
The best way to predict the future is to invent it - Alan Kay