do you have a way to externally test the xpath expression into your html
doc?  I use Xselerator.  If you don't post the sample html and I can
verify the path is returning a nodelist.

code looks correct.

Marty

-----Original Message-----
From: Ben Munat [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 12:23 PM
To: [EMAIL PROTECTED]
Subject: [dom4j-user] xpath not working


The following gives me no output:

public static void main(String[] args) throws DocumentException {
                
        SAXReader reader = new SAXReader();
        Document document = reader.read( "file:///c:/testindex.html" );
        List links = document.selectNodes( "//[EMAIL PROTECTED]" );
        String title = document.valueOf( "//head/title" );
        for(Iterator it = links.iterator(); it.hasNext();){
                Node n = (Node)it.next();
                if (n != null) System.out.println(n.asXML());
        }
        System.out.println(title);
}

testindex.html is a valid html file that exists at the location 
specified. I can parse it and do document.selectSingleNode("/"); and 
when I print that, I get the whole file. But any other xpath expressions
return nothing.

Anyone have any idea what I'm doing wrong?

b



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user
 
NOTICE: This E-mail may contain confidential information. If you are not
the addressee or the intended recipient please do not read this E-mail
and please immediately delete this e-mail message and any attachments
from your workstation or network mail system. If you are the addressee
or the intended recipient and you save or print a copy of this E-mail,
please place it in an appropriate file, depending on whether
confidential information is contained in the message.




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to