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

Reply via email to