Hello,

 

I'm having an issue with a very simple Xpath expression. I don't quite
understand why this fails. Probably missing something obvious. This is
just a simple example:

 

SAXReader r = new SAXReader();

        try {

            Document document = r.read(new File("c:\\file.xml"));

            

            Element metaEle = (Element)
document.selectSingleNode("//meta");

            

        } catch (Exception e) {

            e.printStackTrace();

        }

 

Now < file.xml > definitely has a meta element but this always returns
null. I've tried also selectNodes to see if that makes any difference. I
tried with a bunch of other tags but they all fail unless if I put in
the root tag. If I'm not mistaken though "//meta" should return all meta
elements in the document??? Thanks for any help with this.

 

Matt

 

 

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to