Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: initial
    • Fix Version/s: 1.1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      4

      Description

      The frame lookup via xpath doesn't work on the current cvs version

      Session s = new Session();
      Response r = s.get("http://www.google.com");
      Form form = Forms.getFormByIndex(r,1);
      System.out.println("form = "+form);

      --output--
      [some parse warnings, nothing special]
      form = null
      ------------

        Activity

        Hide
        francisdb added a comment -

        From the forums: (by rah003)
        http://forums.java.net/jive/thread.jspa?forumID=73&threadID=22091

        It actually boils down to the SimpleDocumentBuilder being NS aware. By default
        builder is made from the name space aware factory.

        public SimpleDocumentBuilder() {
        try

        { DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); f.setNamespaceAware(true); builder = f.newDocumentBuilder(); }

        catch (ParserConfigurationException ex)

        { throw new IllegalStateException("Could not create DOM DocumentBuilder", ex); }

        }

        If the f.setNamespaceAware(true); line is commented out, Forms.getFormByIndex()
        will work, yet since the builder is created only once and cached this change may
        have negative effect at other functionality.
        Perhaps adding SimpleDocumentBuilder(boolean namespaceAware) constructor to the
        SimpleDocumentBuilder and changing Forms to have their on instance of the
        builder that is not namespace aware would be an appropriate solution? Or having
        builder to keep both of the instances (NSaware and not) in a cache, but then it
        would have to know when to use which instance.

        Cheers.

        Show
        francisdb added a comment - From the forums: (by rah003) http://forums.java.net/jive/thread.jspa?forumID=73&threadID=22091 It actually boils down to the SimpleDocumentBuilder being NS aware. By default builder is made from the name space aware factory. public SimpleDocumentBuilder() { try { DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); f.setNamespaceAware(true); builder = f.newDocumentBuilder(); } catch (ParserConfigurationException ex) { throw new IllegalStateException("Could not create DOM DocumentBuilder", ex); } } If the f.setNamespaceAware(true); line is commented out, Forms.getFormByIndex() will work, yet since the builder is created only once and cached this change may have negative effect at other functionality. Perhaps adding SimpleDocumentBuilder(boolean namespaceAware) constructor to the SimpleDocumentBuilder and changing Forms to have their on instance of the builder that is not namespace aware would be an appropriate solution? Or having builder to keep both of the instances (NSaware and not) in a cache, but then it would have to know when to use which instance. Cheers.
        Hide
        rah003 added a comment -

        Bumped to the next version.

        Show
        rah003 added a comment - Bumped to the next version.

          People

          • Assignee:
            swingx-ws-issues
            Reporter:
            francisdb
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: