I never found any information about the element order in resulting node-sets. You can force getting a special element in document order using the predicate [n], where n is the document-order based index of the given axis.
e.g.: child::page[@secure='yes'][1] would return the first element page in document order with the attribute secure set to 'yes' regards, hans ----- Weitergeleitet von Hans Prüller/igs am 13.03.2002 12:45 ----- |--------+------------------------------------------> | | Mark Hortman | | | <[EMAIL PROTECTED]> | | | Gesendet von: | | | [EMAIL PROTECTED]| | | eforge.net | | | | | | | | | 12.03.2002 20:53 | | | | |--------+------------------------------------------> >-----------------------------------------------------------------------------------------------------------| | | | An: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> | | Kopie: | | Thema: [Jaxen] Jaxen not following document-order | >-----------------------------------------------------------------------------------------------------------| I have been using Jaxen for a while, and love it. Thanks for all the effort! I believe I have found a very simple test case that shows a flaw in Jaxen, and was wondering if anyone can Show me the errors of my XPath understanding, or confirm a bug. I am using the Jaxen 1.0 beta 8 version, and JDom. The follwing test case fails saying expected b2, but got b4. My understanding is that b2 should be returned. If I remove b1 and b4, from the xml and the java, then the tests succeed. Thoughts???? <?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> SAXBuilder reader = new SAXBuilder(); Document doc = reader.build( BASIC_XML ); XPath xpath = new XPath( "//b" ); List results = xpath.selectNodes( doc.getRootElement() ); assertEquals( 6, results.size() ); Iterator iter = results.iterator(); assertEquals( "b1", ((Element)iter.next()).getAttributeValue("id") ); assertEquals( "b2" ,((Element)iter.next()).getAttributeValue ("id")); assertEquals("b3" , ((Element)iter.next()).getAttributeValue ("id")); assertEquals("b4" , ((Element)iter.next()).getAttributeValue ("id")); assertEquals("b5", ((Element)iter.next()).getAttributeValue("id") ); assertEquals("b6", ((Element)iter.next()).getAttributeValue("id") ); ____________________________________________________ IGS Systemmanagement GmbH & Co KG Dorfplatz 5 A-4531 Piberbach phone: +43 7228 6451 0 home: http://www.igs.at fax: +43 7228 6451 30 eMail: [EMAIL PROTECTED] hotline: fax: +43 7228 6451 20 eMail: [EMAIL PROTECTED] ____________________________________________________ NEWSFLASH___________________________________________ DKC Dokumentation ab sofort unter www.igs.at im Downloadbereich verfügbar Anlagenmanagement ab sofort verfügbar Reservieren Sie sich Ihren persönlichen Demotermin unter: [EMAIL PROTECTED] NEWSFLASH___________________________________________ _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest