XPath, by nature, tends to be bredth-first, which is the ordering you're seeing because that's how I implemented it.
You're seeing them in-order for each level: b1 b4 b2 b3 b5 b6 I guess we could hack to avoid that to always insert elements that were found below a previously selected element, after it. (Well, I know what I meant by that sentence, even if it's not clear to anyone else ;) ) Probably just a migration to using iterator.add() instead of list.add(). -bob On Wed, 20 Mar 2002, Mark Hortman wrote: > Here is a very simple test case. > > //b > > I would expect b1, b2, b3, b4, b5, b6 > All the other programs I have tried return that, Jaxen returns > B1, b4, b2, b3, b5, b6 > > <?xml version="1.0" encoding="UTF-8"?> > <a> > <a> > <b id='b1'></b> > <a> > <b id='b2'></b> > <b id='b3'></b> > </a> > </a> > <a> > <b id='b4'></b> > <a> > <b id='b5'></b> > <b id='b6'></b> > </a> > </a> > </a> > > -----Original Message----- > From: James Strachan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 19, 2002 10:24 AM > To: Mark Hortman; [EMAIL PROTECTED] > Subject: Re: [Jaxen] How to use position() function > > From: "Mark Hortman" <[EMAIL PROTECTED]> > > Can someone help a xpath newbie figure out a simple xpath expression? > > > > Upon learning that //someelement does not guarantee the order that things > > come back in are document order, I have switched tacts and decided to try > to > > handle it my self. I was thinking about playing around with the > position() > > function, but cannot get Jaxen to return the position of an element to me. > > Though generally //someelement will return things in order. Jaxen should > walk the document tree in order matching XPath expressions so for simple > paths like //foo it should work. Or do you have a test case where it > doesn't? > > James > > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > > _______________________________________________ > Jaxen-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jaxen-interest > _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest