You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Joerg Heinicke <jh...@virbus.de> on 2003/05/09 16:27:04 UTC

[jxpath] order of returned objects: //* vs. descendant::*

Hello,

for testing our own XPath implementation I wrote some XPath tests. Some of 
the tests showed strange behaviour. The two XPathes I have in mind are '//*' 
and 'descendant::*', both evaluated on the root context.

The order of the returned objects is different.

XML:

<element1>
   <element1-1>
     <element1-1-1/>
     <element1-1-2/>
   </element1-1>
   <element1-2>
     <element1-2-1/>
     <element1-2-2/>
   </element1-2>
   <element1-3>
     <element1-3-1/>
     <element1-3-2/>
   </element1-3>
</element1>

result of '//*' (same for non-abbreviated syntax 
'/descendant-or-self::node()/child::*'):

element1
element1-1
element1-2
element1-3
element1-1-1
element1-1-2
element1-2-1
element1-2-2
element1-3-1
element1-3-2

result of 'descendant::*'

element1
element1-1
element1-1-1
element1-1-2
element1-2
element1-2-1
element1-2-2
element1-3
element1-3-1
element1-3-2

The second order is the one I expect even if it's a node set and so has no 
sorting (document order) or alphabetically sorted as I heard in JXPath.

What's really strange is the different behaviour of the two expressions.

Regards,

Joerg

-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


Re: [jxpath] order of returned objects: //* vs. descendant::*

Posted by Dmitri Plotnikov <dp...@yahoo.com>.
Jeorg,

I am sorry, I have been completely swamped lately.  I even neglected
GUMP failures for a few days now.  I'll try to take care of this
withing a few days.

- Dmitri

--- Joerg Heinicke <jh...@virbus.de> wrote:
> Hello Dmitri,
> 
> may I ask for the status of your investigation?
> 
> Joerg
> 
> Dmitri Plotnikov wrote:
> > Joerg,
> > 
> > Thanks for reporting this. I will investigate.
> > 
> > - Dmitri
> > 
> > 
> > --- Joerg Heinicke <jh...@virbus.de> wrote:
> > 
> >>Hello,
> >>
> >>for testing our own XPath implementation I wrote some XPath tests.
> >>Some of 
> >>the tests showed strange behaviour. The two XPathes I have in mind
> >>are '//*' 
> >>and 'descendant::*', both evaluated on the root context.
> >>
> >>The order of the returned objects is different.
> >>
> >>XML:
> >>
> >><element1>
> >>   <element1-1>
> >>     <element1-1-1/>
> >>     <element1-1-2/>
> >>   </element1-1>
> >>   <element1-2>
> >>     <element1-2-1/>
> >>     <element1-2-2/>
> >>   </element1-2>
> >>   <element1-3>
> >>     <element1-3-1/>
> >>     <element1-3-2/>
> >>   </element1-3>
> >></element1>
> >>
> >>result of '//*' (same for non-abbreviated syntax 
> >>'/descendant-or-self::node()/child::*'):
> >>
> >>element1
> >>element1-1
> >>element1-2
> >>element1-3
> >>element1-1-1
> >>element1-1-2
> >>element1-2-1
> >>element1-2-2
> >>element1-3-1
> >>element1-3-2
> >>
> >>result of 'descendant::*'
> >>
> >>element1
> >>element1-1
> >>element1-1-1
> >>element1-1-2
> >>element1-2
> >>element1-2-1
> >>element1-2-2
> >>element1-3
> >>element1-3-1
> >>element1-3-2
> >>
> >>The second order is the one I expect even if it's a node set and so
> >>has no 
> >>sorting (document order) or alphabetically sorted as I heard in
> >>JXPath.
> >>
> >>What's really strange is the different behaviour of the two
> >>expressions.
> >>
> >>Regards,
> >>
> >>Joerg
> 
> -- 
> 
> System Development
> VIRBUS AG
> Fon  +49(0)341-979-7419
> Fax  +49(0)341-979-7409
> joerg.heinicke@virbus.de
> www.virbus.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

Re: [jxpath] order of returned objects: //* vs. descendant::*

Posted by Joerg Heinicke <jh...@virbus.de>.
Hello Dmitri,

may I ask for the status of your investigation?

Joerg

Dmitri Plotnikov wrote:
> Joerg,
> 
> Thanks for reporting this. I will investigate.
> 
> - Dmitri
> 
> 
> --- Joerg Heinicke <jh...@virbus.de> wrote:
> 
>>Hello,
>>
>>for testing our own XPath implementation I wrote some XPath tests.
>>Some of 
>>the tests showed strange behaviour. The two XPathes I have in mind
>>are '//*' 
>>and 'descendant::*', both evaluated on the root context.
>>
>>The order of the returned objects is different.
>>
>>XML:
>>
>><element1>
>>   <element1-1>
>>     <element1-1-1/>
>>     <element1-1-2/>
>>   </element1-1>
>>   <element1-2>
>>     <element1-2-1/>
>>     <element1-2-2/>
>>   </element1-2>
>>   <element1-3>
>>     <element1-3-1/>
>>     <element1-3-2/>
>>   </element1-3>
>></element1>
>>
>>result of '//*' (same for non-abbreviated syntax 
>>'/descendant-or-self::node()/child::*'):
>>
>>element1
>>element1-1
>>element1-2
>>element1-3
>>element1-1-1
>>element1-1-2
>>element1-2-1
>>element1-2-2
>>element1-3-1
>>element1-3-2
>>
>>result of 'descendant::*'
>>
>>element1
>>element1-1
>>element1-1-1
>>element1-1-2
>>element1-2
>>element1-2-1
>>element1-2-2
>>element1-3
>>element1-3-1
>>element1-3-2
>>
>>The second order is the one I expect even if it's a node set and so
>>has no 
>>sorting (document order) or alphabetically sorted as I heard in
>>JXPath.
>>
>>What's really strange is the different behaviour of the two
>>expressions.
>>
>>Regards,
>>
>>Joerg

-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


Re: [jxpath] order of returned objects: //* vs. descendant::*

Posted by Dmitri Plotnikov <dp...@yahoo.com>.
Joerg,

Thanks for reporting this. I will investigate.

- Dmitri


--- Joerg Heinicke <jh...@virbus.de> wrote:
> Hello,
> 
> for testing our own XPath implementation I wrote some XPath tests.
> Some of 
> the tests showed strange behaviour. The two XPathes I have in mind
> are '//*' 
> and 'descendant::*', both evaluated on the root context.
> 
> The order of the returned objects is different.
> 
> XML:
> 
> <element1>
>    <element1-1>
>      <element1-1-1/>
>      <element1-1-2/>
>    </element1-1>
>    <element1-2>
>      <element1-2-1/>
>      <element1-2-2/>
>    </element1-2>
>    <element1-3>
>      <element1-3-1/>
>      <element1-3-2/>
>    </element1-3>
> </element1>
> 
> result of '//*' (same for non-abbreviated syntax 
> '/descendant-or-self::node()/child::*'):
> 
> element1
> element1-1
> element1-2
> element1-3
> element1-1-1
> element1-1-2
> element1-2-1
> element1-2-2
> element1-3-1
> element1-3-2
> 
> result of 'descendant::*'
> 
> element1
> element1-1
> element1-1-1
> element1-1-2
> element1-2
> element1-2-1
> element1-2-2
> element1-3
> element1-3-1
> element1-3-2
> 
> The second order is the one I expect even if it's a node set and so
> has no 
> sorting (document order) or alphabetically sorted as I heard in
> JXPath.
> 
> What's really strange is the different behaviour of the two
> expressions.
> 
> Regards,
> 
> Joerg
> 
> -- 
> 
> System Development
> VIRBUS AG
> Fon  +49(0)341-979-7419
> Fax  +49(0)341-979-7409
> joerg.heinicke@virbus.de
> www.virbus.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com