commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir (JIRA)" <>
Subject [jira] Created: (JXPATH-99) JXPath works incorrectly with CyberNeko HtmlParser
Date Thu, 16 Aug 2007 21:49:30 GMT
JXPath works incorrectly with CyberNeko HtmlParser

                 Key: JXPATH-99
             Project: Commons JXPath
          Issue Type: Bug
    Affects Versions: 1.2 Final
            Reporter: Vladimir

I don't know exactly where is the bug. I have an idea, that CyberNeko html parser creates
some wired w3c DOM representation of html file, and that is the cause. Here is a code sample:
// ---------------------------
       // create CyberNeko html parser 
        DOMParser parser = new DOMParser();
        // this page does have //input[@name='q'] field
        Document doc = parser.getDocument();

        // JXPATH TEST
        JXPathContext context = JXPathContext.newContext(doc);
        List nodes1 = context.selectNodes("//input[@name='q']"); // ERROR IS HERE: call returns
nothing, must return 1 node
        List nodes2 = context.selectNodes("//*"); // returnes 78 nodes

        // XPathFactory TEST  ( for comparison )
        // error, returns nothing
        Object list1 = XPathFactory.newInstance().newXPath().compile("//input[@name='q']").evaluate(doc,
        // returns 79 nodes
        Object list2 = XPathFactory.newInstance().newXPath().compile("//*").evaluate(doc,
// -----------------------------------

Is it possible to fix this problem inside JXPath? Or is it only html parser problem?

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message