0

i am trying to post some xml data using Groovy's HttpBuilder. POST XML data with Groovy HTTPBuilder answers the question on how to generate attributes (as id below)

<person id="1"></person>

but does not suggest how to specify value for this node. i have tried with constructs such as

apicall{
  user "userName"
  person(name:"name") "personName"
}

which generates an XML

<apicall>
  <user>userName</user>
  <person name='name'></person>
</apicall>

but the personName is missing! please suggest what am i missing here.

Community
  • 1
  • 1
shwetank
  • 115
  • 3
  • 7

1 Answers1

0

See: http://www.javaworld.com/community/node/3017. They use

body: {
  widget(id:'129033'){
    type("TFR")
  }
}

which will be encoded to

<widget id='129033'>
  <type>TFR</type>
</widget>
Will
  • 2,858
  • 6
  • 33
  • 50
  • Thanks Will! i was late by a moment :) groovy.xml.StreamingMarkupBuilder helped me achieve this. The required construct should be person(name:"name", "personName") and that created the XML i wanted! thanks for your reply though! – shwetank Dec 10 '12 at 12:34