Hello, is there any possibility to test if there is a specific XPath Node in an XML Document.
For Example: I've got an Document A which contains the specific XPath (Root//namespace:Element//namespace:@id) And I've got an Document B which contains this specific XPath not. I tried an [JAVA] if ( doc.selectSingleNode("//Root//namespace:Element//namespace:@id") != null ) [/JAVA] but didn't really expect to get it work. I got the following exception: "XPath expression uses unbound namespace prefix" So it is and namespace problem again. I tried the same JAVA code for very simple XML without any Namespace an it works. The XML: [XML] <TEST> <A> </A> <B> <C> TEST </C> </B> </TEST> [XML] And the JAVA-Code: [JAVA] if ( doc.selectSingleNode("//TEST//B//C") != null ){ System.out.println("Dokument1");} else {System.out.println("NO");} [/JAVA] With the XML I got "Dokument1" with another testXML I got "NO". Even with namespace XML I got "NO" then. The problem is: I can't leave out the namespace. A possible (but untestet solution until now) could be to temporarilly insert the namespace (with JAVA) in the XML which I want to test and afterwards to delete it. Because there are only about 20 possible namespaces it would be OK. But I'm not sure if it would work and I don't think it would be the best variant to do so. So maybe you got any solution how I could test an XML for an specified XPath. Thanks and best regards, André -- GRATIS fÌr alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user