Right.  Actually in my case it could be better than that.  SInce I want
StingFunction.evaluate function takes object...I don't even need to cast:

            SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build( args[0] );
            XPath xpath = new XPath( args[1] );
            List results = xpath.selectNodes( doc );
            
            Iterator resultIter = results.iterator();
            Navigator navigator = xpath.getNavigator();

            while ( resultIter.hasNext() )
            {
                Object obj = resultIter.next();
                System.out.println("hERE IS obj: " +
StringFunction.evaluate(obj, navigator));
            }

args[1] can be going after an Element or an Attribute if
StringFunction.evaluate always just printed the value of Attr or
Elements...Attributes work great (just returns obj.getValue()) but
getElementStringValue doesn't print just the Element's getText() as I would
like it to...I guess that I could just replace the JDOM DocumentNavigator
with a custom one...

tcp

-----Original Message-----
From: bob mcwhirter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 11:04 AM
To: Tom Preston
Cc: [EMAIL PROTECTED]
Subject: RE: [Jaxen] using [@name] inside of JAXEN


On Tue, 19 Mar 2002, Tom Preston wrote:

> Yes. Of course I was using the wrong syntax to get a list of Attributes.
> This way I will get list of Attributes or Elements...I can test using
> instanceof whether to cast to Attribute or Element and problem solved.
> Thanks.

Well, since the last step of the location path is an attribute-step
(it starts with '@'), then you're guaranteed to only get back attributes,
not elements.

        -bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to