2 ms·
No you don't. Please look up Dom4j which simply lets you do List<Element> nodes = element.selectNodes(XPATH) Element singleNode = element.selectSingleNode(XPATH
by guard-of-terra 15y ago
No you don't. Please look up Dom4j which simply lets you do
List<Element> nodes = element.selectNodes(XPATH)
Element singleNode = element.selectSingleNode(XPATH)
it also has .valueOf(XPATH) and even .numberValueOf(XPATH)
- specialist 15y agoBut then I'd have to use DOM4j. More seriously, I didn't even think to look at DOM4j again, so didn't know it wrapped JXPath. I had been using XOM for a while, a HUGE improvement over JDOM and DOM4j. Elliot Harold's FAQ and slides explain his improvements. LOX has an even more simple object model, uses JDK 1.5 idioms, and is MUCH easier to interactively debug. (LOX also doesn't recognize namespaces, which keeps it simple.) When it came time to do path expressions, I initially used JXPath and then Jaxen. Both are very hard to debug. After a hard rethink, wanting an API that supports how I like to work, I dropped XPath and came up something a lot more simple, a lot smaller, and closer to how I work. LOX's path expressions have only 1-axis (to use a XPath-ism), parent to child. I've never used any of the other axis, so no big loss. LOX also supports globbing (wildcarding) syntax, which is a huge win over XPath.