You will have to map your "http://www.example.de"; namespace uri to a
prefix and use this prefix in your xpath expression.

Try the following:

> SAXReader reader = new SAXReader();
> reader.setValidation(false);
> org.dom4j.Document document = reader.read(new File("D:/TMP/test.xml"));

HashMap map = new HashMap();
map.put("x", "http://www.example.de";);

String expression = "//x:File[starts-with(x:Dataformat,'Word')]/x:Dataname";

> XPath xpath = document.createXPath(expression);
xpath.setNamespaceContext(new SimpleNamespaceContext(map));

> Node n = xpath.selectSingleNode( document );
> log.debug("!" + n.getText());

Regards,
Edwin
-- 
http://www.edankert.com/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to