You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Radu Preotiuc-Pietro <ra...@bea.com> on 2008/04/03 22:38:22 UTC

Re: selectPath returning incorrect results

Unfortunately, I think this is a bug in the XMLBeans XPath engine.

What I can recommend is using Saxon (make sure it's 8.8) to execute
XPath to work around this.

Also, make sure to open a JIRA issue if you have an account or let me
know and I can open one for you.

Radu

On Thu, 2008-03-27 at 17:40 +0000, Paul Hepworth wrote:
> Hi
>  
> Hopefully someone can point me in the direction where I'm going wrong
> with this one:
>  
> If I have the following XML:
> <a>
>   <b>
>     <c>val1</c>
>     <d>
>       <c>val2</c>
>     </d>
>   </b>
>   <c>val3</c>
> </a>
>  
> If I execute the following XQuery: .//b/c
> I would expect one result to come back, however, using xmlbeans 2.3,
> it seems to select the val2 c as well!?
>  
> Here's a test class:
> public class TestSelectPath {
>     public static void main(String[] args) {
>         final XmlObject obj =
> XmlObject.Factory.parse("<a><b><c>val1</c><d><c>val2</c></d><c>val3</c></a>");
>         final XmlCursor c = obj.newCursor();
>         c.selectPath(".//b/c");
>         System.out.println(c.getSelectionCount());
>         c.dispose();
>     }
> }
>  
> As far as I'm aware, it should only return one result. If I add the a
> in and don't use the // (./a/b/c) then I get the correct result.
> However, this approach isn't workable in my application.
>  
> I'm running java 1.4, with xmlbeans-qname-2.3.0.jar,
> xmlbeans-2.3.0.jar and stax-api-1.0.1.jar on my classpath.
>  
> Can anyone help??
>  
> Cheers
> Paul
> 
> 
> 
> This message should be regarded as confidential. If you have received
> this email in error please notify the sender and destroy it
> immediately.
> Statements of intent shall only become binding when confirmed in hard
> copy by an authorised signatory. The contents of this email may relate
> to dealings with other companies within the Detica Group plc group of
> companies.
> 
> Detica Limited is registered in England under No: 1337451.
> 
> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP,
> England.
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org