tags:

views:

23

answers:

0

I am having a blank xml file with the code below.

 new OutputStreamWriter(new FileOutputStream("test.xml"), 'utf-8') << XmlUtil.serialize(builder.bind{
     mkp.xmlDeclaration()
    strings
    {
      textitem (id:string_id)
      {
         text("example string")
      }


   }})

However when I try to println the xml, it displays the pretty-printed xml in the console and when I do not use the XmlUtil.serialize method the xml file contains the strings.Any reason why it cannot get written into the xml file?