commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Lensing <i...@softcon-lensing.de>
Subject [jxpath] newbie: iterator / name() / @-values
Date Mon, 14 Apr 2003 08:58:36 GMT
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



Mime
View raw message