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

gpath syntax for xml documents with namespaces

    XMLWordPrintableJSON

Details

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

    Description

      currently, gpath expressions support xml namespaces, as fixed in issue GROOVY-953. however, as xml namespaces are usually long urls, using namespaces in gpath expressions become an impraticable task. example:

      given the following xml:

      <bar xmlns:x="http://a.very.long.namespace.goes.here">
      <x:node x:test="foo" />
      </bar>

      to get the value "foo", we need to build the following gpath expression (assume "xml" as a representative of the "bar" node):

      xml."http://a.very.long.namespace.goes.here:node"["http://a.very.long.namespace.goes.here:test"]

      but if namespace aliases were enabled, it should be possible to select the same value with the following gpath expression:

      xml."x:node"["x:test"]

      is it possible to implement? i think this way it would be easier to parse complex xml documents with groovy

      thanks!

      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: