commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: [jxpath] newbie: iterator / name() / @-values
Date Mon, 14 Apr 2003 15:39:20 GMT
Jeorg,

1. Use iteratePointers instead of iterate.
2. The name() function works fine with JXPath.
3. For attribute values try this: "/*/@*"

I hope this helps.

- Dmitri


--- Joerg Lensing <info@softcon-lensing.de> wrote:
> hi list,
> (sorry for cross-posting. i took the wrong list first)
> 
> I'm using this xpath-String :
>          > String xpathString = "/*";
> 
> and
> 
>  >           JXPathContext context =
> JXPathContext.newContext(recipes);
>  >
>  >           Iterator resultSet = context.iterate(xpathString);
>  >           //String result = (String)
> context.getValue(xpathString);
>  >
>  >           while (resultSet.hasNext()) {
>  >               Object aObj = (Object) resultSet.next();
>  >             String result = (String) aObj;
>  >             System.out.println("The result is: " + result);
>  >           }
> 
> 
> The first retrieved object from resultSet.next() contains the
> complete
> values from _all_ nodes. That is not what i expected. I expected to
> get
> the nodes one after another
> 
> My questions:
> 1. How can i iterate through the node-list(only if i selected
> multiple 
> nodes like above)?
> 2. How can i get the node-name (like the name()-function in xpath)?
> 3. How can i get the value of attributes?
> 
> 
> joerg
> 
> 
> 
> ---------------------------------------------------------------------
> 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! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

Mime
View raw message