Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Usage of the MarkupBuilder: is it possible to create a document in several steps?

Jean-Noël Rivasseau

2008-08-08

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,

I am trying to use Groovy specific methods for generating an XML
document. Using the builder seems nice, however it seems to me this is
mostly useful to generate an XML tree document "all at once" from an
existing data structure. If I want to modularize the creation of the
XML, I dont know how to do this or if it is even possible.

Let's take the example:

xml.body()
{
someNode("myValue")
}

// do something else there

Now I'd like to add a child node to someNode (or even to the body
node). Is this possible at all? I tried xml.body.someNode()
{
anotherNode("hello")
}

but it did not work. Is the builder not intended for such
modularizable, dynamic creation of XML? It works great for outputting
a document in one time... Note that I can add "root nodes" by doing
xml.anotherNode(), so it may be that I just dont know how to properly
do what I want.

Jean-Noel

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.