for the Below code :
def writer = new StringWriter()
writer = new StreamingMarkupBuilder().bind {
Project(){MyTag('Help Me')}
}
println(writer.toString())
the output would be: <Project><MyTag>Help Me</MyTag></Project>
Now if i have "MyTag('Help Me')" in above code as a string var and want to use as shown below
def teststring = "MyTag('Help Me')"
def writer = new StringWriter()
writer = new StreamingMarkupBuilder().bind {
Project(){out<<teststring}
}
println(writer.toString())
the output am getting is: MyTag('Help Me')<Project></Project>
but am expecting: <Project><MyTag>Help Me</MyTag></Project>
Am new to groovy,anybody help me with proper implementation or find the mistake for the above case ? Please let me know if I had to use other class other than StreamingMarkupBuilder and XmlMarkupBuilder ? Note that in actual scenario for me the text variable actually contains a lot more of child nodes nested .