|
Well, I gave that a shot and it was much faster. I looked at the code,
because I don't want to capitalize my xhtml, and it's just walking the
tree. I was thinking it'd be maintaining a hashtable or something.
Makes you wonder why jaxen's so much slower... So, I'll probably just
write my own walking function that looks for the lower case id. Here's
the code I looked at: Thanks Edwin, --Evan public Element elementByID(String elementID) { for (int i = 0, size = nodeCount(); i < size; i++) { Node node = node(i); if (node instanceof Element) { Element element = (Element) node; String id = elementID(element); if ((id != null) && id.equals(elementID)) { return element; } else { element = element.elementByID(elementID); if (element != null) { return element; } } } } return null; } protected String elementID(Element element) { // XXX: there will be other ways of finding the ID // XXX: should probably have an IDResolver or something return element.attributeValue("ID"); } Edwin Dankert wrote:
|
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ dom4j-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dom4j-user
