You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by LANTRES Franck <fr...@fr.renault-sport-f1.com> on 2004/01/30 10:21:52 UTC
[JXPATH] - misunderstood XPath response
Hi,
I request a XML document which could be something like that :
<ROOT>
<FOO>
<NAME>my_name</NAME>
<ID>my_id</ID>
</FOO>
<FOO>
<NAME>your_name</NAME>
<ID>your_id</ID>
</FOO>
</ROOT>
As I would like to get a particular FOO, I use the following XPath query
:
document/ROOT/FOO[NAME='my_name']
The XML I expect is
<FOO>
<NAME>my_name</NAME>
<ID>my_id</ID>
</FOO>
But I get :
<FOO>
<NAME>my_name</NAME>
<ID>my_id</ID>
</FOO>
<FOO>
<NAME>your_name</NAME>
<ID>your_id</ID>
</FOO>
If I use the query document/ROOT/FOO[NAME='my_name']/*, I get the nodes
I expect but without the FOO one, ie :
<NAME>my_name</NAME>
<ID>my_id</ID>
Where is the problem/bug ?
Thanks for your help.
Franck.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
RE : [JXPATH] - misunderstood XPath response
Posted by LANTRES Franck <fr...@fr.renault-sport-f1.com>.
Here is another problem I get from this morning :
I still use the same example.
If I use the "document/ROOT/FOO/ID" XPath query, I get two matches :
- the first contains <ID>my_id</ID><ID>your_id</ID>
- the second contains <ID>your_id</ID>
Note that I use pointers and the method context.iteratePointers.
I really don't understand how JXPath is working ......
Help !!!!
Franck.
> -----Message d'origine-----
> De : LANTRES Franck [mailto:franck.lantres@fr.renault-sport-f1.com]
> Envoyé : vendredi 30 janvier 2004 10:22
> À : commons-user@jakarta.apache.org
> Objet : [JXPATH] - misunderstood XPath response
>
>
> Hi,
>
> I request a XML document which could be something like that : <ROOT>
> <FOO>
> <NAME>my_name</NAME>
> <ID>my_id</ID>
> </FOO>
> <FOO>
> <NAME>your_name</NAME>
> <ID>your_id</ID>
> </FOO>
> </ROOT>
>
>
> As I would like to get a particular FOO, I use the following
> XPath query
> :
> document/ROOT/FOO[NAME='my_name']
> The XML I expect is
> <FOO>
> <NAME>my_name</NAME>
> <ID>my_id</ID>
> </FOO>
>
> But I get :
> <FOO>
> <NAME>my_name</NAME>
> <ID>my_id</ID>
> </FOO>
> <FOO>
> <NAME>your_name</NAME>
> <ID>your_id</ID>
> </FOO>
>
> If I use the query document/ROOT/FOO[NAME='my_name']/*, I get
> the nodes I expect but without the FOO one, ie :
> <NAME>my_name</NAME>
> <ID>my_id</ID>
>
>
> Where is the problem/bug ?
>
> Thanks for your help.
>
> Franck.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org