I was just doing some performance testing and discovered that changing all my xpath expressions like this:

String str = document.valueOf("/article/title");

to

Element root = document.getRootElement();
String str = root.elementText("title");

Created a huge performance speedup. This makes sense I guess but after reading the paper on xpath performance in dom4j I would have expected decent performance with xpath. It could be that I just have a small document and if I were recursing a large set doing an expression like */*/author would be much faster than manually iterating.

My question is, with dom4j in which cases is xpath preferable to manually iterating over the document structure?


Thanks, Paul



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to