Hi Joseph,

This is due to the fact that the namespace support is more compliant
with the standard than the old version. The ENTRY element is most
probably in a default namespace, and the XPath statement needs to
reflect that fact, for example by using a namespace context.

James wrote a mail on this about a month ago:

>Generally the reason for your problem is that default namespaces don't
work nicely in XPath. If you 
>had a document like this
>
><doc xmlns="foo">hello</doc>
>
>Then the XPath expression /doc will not match anything! This might seem
kinda strange at first but 
>its because the name comparison uses namespace URIs.
>
>Incidentally if you change your document to use a prefix...
>
><d:doc xmlns="foo">hello</d:doc>
>
>Then you can use the XPath expression /d:doc in dom4j.
>
>If you don't specify a NamespaceContext, dom4j will use the default
namespaces in scope on the node on which you perform the query, >which
for a document will be the root element.

Regards,

-- Steen

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> Joseph Rajkumar
> Sent: 27. december 2001 18:53
> To: [EMAIL PROTECTED]
> Subject: [dom4j-user] Question with XPATH in dom4j-1.1
> 
> 
> Hi Folks
> 
>    We have been using dom4j-0.5 for quite a while and 
> recently upgrading to dom4j-1.1 and I have a quick question:
> 
> XPATH = "//ENTRY" returns ZERO nodes on my xml file, whereas 
> XPATH = "//*[name()='ENTRY']" returns the CORRECT results.
> 
>    Has there been some radical changes or am I missing something.
> 
> Regards
> Joseph Rajkumar
> 
> email: [EMAIL PROTECTED]
> 
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED] 
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
> 


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to