Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6304 Configslurper Issues
  3. GROOVY-3558

ConfigSlurper - not able to create property containing xml using MarkupBuilder/StreamingMarkupBuilder

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.6.3
    • None
    • groovy-jdk
    • None
    • Mac OS X 10.5.7

    Description

      when use the following as an config file:

      import groovy.xml.StreamingMarkupBuilder
      
      def xml = new StreamingMarkupBuilder().bind{
        records {
          car(name:'HSV Maloo', make:'Holden', year:2006) {
            country('Australia')
            record(type:'speed', 'Production Pickup Truck with speed of 271kph')
          }
        }
      }
      definedxml= "<?xml version='1.0' encoding='UTF-8'?>" + xml.toString()
      

      and use ConfigSlurper to parse the file, I get the following value when asking for "definedxml" property:

      <?xml version='1.0' encoding='UTF-8'?><country>Australia</country><record type='speed'>Production Pickup Truck with speed of 271kph</record>
      

      However I do expect to get:

      <?xml version='1.0' encoding='UTF-8'?><records><car name='HSV Maloo' make='Holden' year='2006'><country>Australia</country><record type='speed'>Production Pickup Truck with speed of 271kph</record></car></records>
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tknappek Tomas Knappek
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: