Amazing :) You save my day :)

Thanks a lot!!


-------- Original-Nachricht --------
Datum: Wed, 30 May 2007 16:28:27 +0100
Von: "Edwin Dankert" <[EMAIL PROTECTED]>
An: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
CC: dom4j-user@lists.sourceforge.net
Betreff: Re: [dom4j-user] (no subject)

> 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

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

-------------------------------------------------------------------------
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