Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1035

gpath is broken when using xml namespaces in attributes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-JSR-4
    • None
    • None

    Description

      GPath can address xml nodes with namespaces enabled, but when the node is an attribute (and it belongs to a specific xml namespace) the selection always returns null.

      Example xml file:

      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about="#Potato">
      </rdf:Description>

      <rdf:Description rdf:about="#Salad">
      </rdf:Description>
      </rdf:RDF>

      It is impossible to return all "rdf:about" attribute values with the current implementation of xml namespaces support in gpath. Though, element nodes can be addressed, as well as namespaceless general nodes.

      being "xml" the "rdf:RDF" node, we have the following:

      xml."http://www.w3.org/1999/02/22-rdf-syntax-ns#:Description"["@http://www.w3.org/1999/02/22-rdf-syntax-ns#:about"] returns [null, null] instead of "#Potato", "#Salad"

      Also, GROOVY-1033 addresses a similar issue, regarding xml namespaces aliases.

      Attachments

        Issue Links

          Activity

            People

              jstrachan James Strachan
              rui lopes Rui Lopes
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: