[jdom-interest] Jaxen method of matching XPath

Anna Afonchenko anna at ubaccess.com
Tue Mar 23 07:18:14 PST 2004

I am using JDOM to access and change some XML file.
I noticed that when I apply some XPath, the nodes match by Depth First Search, not by Breadth First Search (as in saxon, for example).
E.g., when applying XPath //a on the next document:
First the <a>2</a> will be matched, and then <a>1</a>.
This is how I apply it in the code:
//read in the xml file
Document xmlDocument = new SAXBuilder().build(xmlDocument);
org.jaxen.XPath path = new JDOMXPath(sXPath);
currentElement = (Element) path.selectSingleNode(xmlDocument);
XMLOutputter outputter = new XMLOutputter();
return outputter.outputString(currentElement);

Is there any possible way of forcing jaxen to perform BFS match for XPath? So that for the previous xml file and XPath it will return as a result <a>1</a>.

I apologise if this question was asked before, it is not in the FAQ,
and I could not find something similar in the archives.

Thank you very much for help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040323/0bcd8457/attachment.htm

More information about the jdom-interest mailing list