Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-1005

Multi-namespace xpath queries not functioning!

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 2.3
    • None
    • XPath
    • None
    • Operating System: All
      Platform: HP
    • 9081

    Description

      When using the ...

      public static Node selectSingleNode(Node contextNode,
      java.lang.String str,
      Node namespaceNode)
      or

      public static Node selectSingleNode(Node contextNode,
      java.lang.String str)

      methods of XPathAPI or CachedXPathAPI on a Document object that contains
      multiple namespaces ... the method returns null every time!
      For instance, take the following markup ...

      <?xml version="1.0" encoding="UTF-8"?>
      <parent parentId="123">
      <parms targetNamespace="http://foo.com/" xmlns="http://foo.com/">
      <foo><name>foo</name></foo>
      </parms>
      </parent>

      The following XPathAPI query returns null!

      Document doc = DocumentBuilder.parse("pathtofoo.xml");
      Element elParent = doc.getDocumentElement();
      Element elName = XPathAPI.selectSingeNode(elParent, "parent/foo/name");

      i've also tried ...

      Element elName = XPathAPI.selectSingeNode(elParent, "parent/foo/name",
      elParent);

      still returns null! Any clues?

      Attachments

        Activity

          People

            Unassigned Unassigned
            fvillarreal@directhitdata.com Frank Villarreal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: