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

internally declared namespaces not resolved correctly by XPath processor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 2.3
    • None
    • XPath
    • None
    • Operating System: Other
      Platform: Other
    • 9167

    Description

      output below should explain

      [adunsta:samples]$ cat foo.xml
      <a:b xmlns:a="q">
      <b:c xmlns:b="w">
      <b:d>Foobar</b:d>
      </b:c>
      </a:b>
      [adunsta:samples]$ java -
      cp ../bin/xalan.jar:../bin/xalansamples.jar:../bin/xercesImpl.jar:. ApplyXPath
      foo.xml '/a:b'
      Loading classes, parsing foo.xml, and setting up serializer
      Querying DOM using /a:b
      <output>
      <a:b xmlns:a="q">
      <b:c xmlns:b="w">
      <b:d>Foobar</b:d>
      </b:c>
      </a:b>
      </output>
      [adunsta:samples]$ java -
      cp ../bin/xalan.jar:../bin/xalansamples.jar:../bin/xercesImpl.jar:. ApplyXPath
      foo.xml '//b:c'
      Loading classes, parsing foo.xml, and setting up serializer
      Querying DOM using //b:c
      Exception in thread "main" javax.xml.transform.TransformerException: Prefix
      must resolve to a namespace: b
      at org.apache.xpath.compiler.XPathParser.error(XPathParser.java:602)
      at org.apache.xpath.compiler.Lexer.mapNSTokens(Lexer.java:674)
      at org.apache.xpath.compiler.Lexer.tokenize(Lexer.java:397)
      at org.apache.xpath.compiler.Lexer.tokenize(Lexer.java:139)
      at org.apache.xpath.compiler.XPathParser.initXPath(XPathParser.java:143)
      at org.apache.xpath.XPath.<init>(XPath.java:217)
      at org.apache.xpath.XPathAPI.eval(XPathAPI.java:279)
      at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:172)
      at org.apache.xpath.XPathAPI.selectNodeIterator(XPathAPI.java:152)
      at ApplyXPath.doMain(ApplyXPath.java:128)
      at ApplyXPath.main(ApplyXPath.java:183)
      [adunsta:samples]$ pwd
      /home/adunsta/xalan-j_2_3_1/samples
      [adunsta:samples]$

      Attachments

        Activity

          People

            Unassigned Unassigned
            adunstan@hiddenmind.com Andrew Dunstan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: