Hi,I have an XML file like this:articleSet article title /title author /author /article article title /title author /author /article/articleSetusing dom4j I put this XML into a org.dom4j.Document (named xmlDoc) andfor each "article" Node I wuold like to do some stuff so I wrote this codeIterator iter = xmlDoc.selectNodes("//article").iterator(); while(iter.hasNext()){ Node n = (Node)iter.next(); System.out.println(n.asXML()); System.out.println(n.selectSingleNode("//title").getText()); }the problem is that the first "println" prints correctly the content ofeach "article" Node but the second prints always the FIRST article titlebecause the XPath search is done on entire document and not only insidethe current node.Why this behaviour? I made some mistakes?dat
|
|
0
|
|
|
|
Reply
|
dat
|
10/16/2007 3:19:31 PM |
|