[dom4j-user] Xpath and Namespaces

2003-05-31 Thread martin . me . roberts
Title: Xpath and Namespaces Hi, I have noticed that the DOM4J examples XPathTool.java does not work if the Xpath is defined inline rather than in the outside node of the file. So root xmlns:as=url as:elt/ /root With xpath //as:elt will work but if you try it against:

[dom4j-user] JTidy-Dom4j-NullPointerException

2003-05-31 Thread Marco Phler
Hi, I want to use XPath Expressions on a HTML page. I use JTidy to convert a page into XHTML. This XHTML can be easily transformed into a dom4j Document. My current problem is that I get a NullPointerException if I try to access any Node in the page using a XPath Expression. I don't understand

Re: [dom4j-user] JTidy-Dom4j-NullPointerException

2003-05-31 Thread David D. Lucas
Marco, After looking at the code, I am not sure you realize that document.selectSingleNode will return null if the expression is not found. This probably why it was a null pointer exception. Try checking if (table!=null) before processing it. Also take a look at XPE at

Re: [dom4j-user] JTidy-Dom4j-NullPointerException

2003-05-31 Thread David D. Lucas
Did you test with the complete file or just a snippet? You have a default namespace defined in the root. .append(html xmlns=\http://www.w3.org/1999/xhtml\;) You may want to use the /*[local-name()='html']/*[local-name()='body'] to avoid the namespace all together. Give that a try.