Hi tom,
if I understood your mail, you want to retrieve a list of attributes but get a list of elements. I don't know if this is your problem, but in my opinion the XPath-Exrpession you use "/TRIPS/TRIP/VACATION_ID[@name]" is defined to return elements HAVING an attribute name set to a value, to get a list of the name-Attributes itself it should be like "/TRIPS/TRIP/VACATION_ID/@name" so you need a further location step - not a predicate hope i could help, hans |--------+------------------------------------------> | | Tom Preston | | | <[EMAIL PROTECTED]> | | | Gesendet von: | | | [EMAIL PROTECTED]| | | eforge.net | | | | | | | | | 19.03.2002 16:39 | | | | |--------+------------------------------------------> >-----------------------------------------------------------------------------------------------------------| | | | An: [EMAIL PROTECTED] | | Kopie: | | Thema: [Jaxen] using [@name] inside of JAXEN | >-----------------------------------------------------------------------------------------------------------| While dynamically trying to retrieve an Attribute value using Jaxen...I find that I have a problem. I have to "KNOW" within my program that I have searched for an Attribute as opposed to an Element. This is because the XPath selectNodes returns a list of Elements (using JDOM) that contain the attributes instead of a list of Attributes. I'm fine with it returning a list of Elements and think that this may often be helpful since you know that you are free to cast the List elements into JDOM Element instances. The problem that I have is that I have to know that my "dynamic" xpath expression was ACTUALLY asking for Attributes of a certain name...then I have to go thru the Elements returned and pick out the values of the named attributes....this takes away from the dynamic nature of the program (or causes me to have to know things that I wish JAXEN would know for me). Is there a way around this problem. Example StringFunction.evaluate(e, navigator) will not print the "name" attribute value, but will instead print the value of the element which contains the "name" attribute: Document doc = builder.build( args[0] ); XPath xpath = new XPath( "/TRIPS/TRIP/VACATION_ID[@name]"); List results = xpath.selectNodes( doc ); Iterator resultIter = results.iterator(); Navigator navigator = xpath.getNavigator(); while ( resultIter.hasNext() ) { Element e = (Element)resultIter.next(); System.out.println( e.getText() ); System.out.println( e.getAttribute("name").getValue() ); System.out.println("hERE IS E: " + StringFunction.evaluate(e, navigator)); } becuase inside of StringFunction it will hit: else if ( nav.isElement( obj ) ) { return nav.getElementStringValue( obj ); } instead of: else if ( nav.isAttribute( obj ) ) { return nav.getAttributeStringValue( obj ); } tcp ____________________________________________________ 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