Create groovy xml with an "envelop" - add nodes in the middle of a xml structure -


(Sorry for the strange title ...)

I want to use the groovy builder system Make an XML.

My problem is that I have to put a heap of something on which the user has to ignore.

An example:

  def builder = new groovy.xml.MarkupBuilder () builder.foo () {bar ('hello')}  

should create it

  & lt; Some ID: '123' & gt; & Lt; AnyInfo & gt; & Lt; Foo & gt; & Lt; Bars & gt; Hello & lt; / Bars & gt; & Lt; / Foo & gt; & Lt; / AnyInfo & gt; & Lt; / Some & gt;  

so that there is an xml structure in the background, in which the user can add his XML structure to a predefined node (in the example 'AnyInfo')

It is to be seen that I can add a nodes somewhere in the middle of the pile with the markup builder (or any other builder)?

I hope this is somehow understandable ?!

Thanks Marty

You can do this easily with shutdown. Close one to make the cover. Then you can dynamically remove your hand in the closing which creates real content. Example:

  def author = new stringwriters () def builder = new groovy.xml. MarkupBuilder (Author) def createraprap = {Close c-> Builder. Something (id: 123) {AnyInfo () {c ()}}} createWrapper {builder.foo () {bar ('hello')}} println writer.toString ()  

As a result this sample XML is what you were looking for.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -