XalanJ2
  1. XalanJ2
  2. XALANJ-1030

XPathAPI selectNodeIterator(doc, xpath) with default namespace

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Resolution: Incomplete
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: XPath
    • Labels:
      None
    • Environment:
      Operating System: Windows NT/2K
      Platform: PC

      Description

      In xalan-j2.3.1, on Windows 2000 SP2,
      the following xpath retrieval, using the ApplyXPath example
      java ApplyXPath trydef.xml "/xxx/yyy"
      fails on the file, trydef.xml, which uses the default namespace.

      <?xml version="1.0" ?>
      <xxx xmlns="a:b//c">
      <yyy>
      <zzz aaa="333">
      </zzz>
      </yyy>
      </xxx>

      The corresponding retrieval
      java ApplyXPath trynone.xml "/xxx/yyy"
      works as expected on the file, trynone.xml, which has no namespace

      <?xml version="1.0" ?>
      <xxx>
      <yyy>
      <zzz aaa="333">
      </zzz>
      </yyy>
      </xxx>

      The corresponding retrieval using a namespace prefix also works:
      java ApplyXPath trypref.xml "/q:xxx/q:yyy"

      <?xml version="1.0" ?>
      <q:xxx xmlns:q="a:b//c">
      <q:yyy>
      <q:zzz aaa="333">
      </q:zzz>
      </q:yyy>
      </q:xxx>

      Perhaps this is related to bug #6479?

        Issue Links

          Activity

          Hide
          Joe Kesselman added a comment -

          The XPath you gave should NOT match the document you showed us; XPath is
          namespace-aware and currently requires that namespaces always be specified via
          a prefix even if the default-namespace (xmlns=) mechanism was used in the
          instance document. Please see recent discussion in the Xalan Users mailing list
          for information about namespace resolution.

          Show
          Joe Kesselman added a comment - The XPath you gave should NOT match the document you showed us; XPath is namespace-aware and currently requires that namespaces always be specified via a prefix even if the default-namespace (xmlns=) mechanism was used in the instance document. Please see recent discussion in the Xalan Users mailing list for information about namespace resolution.
          Hide
          Jeff Greif added a comment -

          Oops. This bug appears to be similar to #3415. The XPath
          "/:xxx/:yyy" works for the default namespace in the failing case above.
          Apologies for the duplicate!

          Show
          Jeff Greif added a comment - Oops. This bug appears to be similar to #3415. The XPath "/:xxx/:yyy" works for the default namespace in the failing case above. Apologies for the duplicate!

            People

            • Assignee:
              Unassigned
              Reporter:
              Jeff Greif
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development