As you say, DOMBuilder is not really what you want…it’s really about building a document from a pre-existing string/source.
You can take a look at: http://www.groovy-lang.org/processing-xml.html To see some of the standard facilities (that i suspect you already know about). There is also: http://docs.groovy-lang.org/latest/html/gapi/groovy/xml/StaxBuilder.html http://docs.codehaus.org/display/GROOVY/Processing+XML BOB > On 4 May 2015, at 8:07 am, Keith Suderman <[email protected]> wrote: > > I need to build an org.w3c.dom.Document object programmatically and I > thought, given its name, groovy.xml.DOMBuilder might be useful. However, the > DOMBuilder class does not appear to be a “builder” in the same sense that > MarkupBuilder is. That is, > > Document document = aDocumentBuilder.newDocument() > new DOMBuilder(document).root { > parent { > child ‘text’ > child ‘more text’ > } > } > > does not seem to build a Document. Am I missing something or does DOMBuilder > not do what I want? Writing my only little builder isn’t a problem, but I > don’t want to reinvent the wheel. > > Note: I am trying to avoid building an XML string and parsing that into a > DOM object as I am already parsing other data (JSON) and I want to avoid > JSON->XML->DOM, I would prefer PARSER_EVENTS -> DOM > > Cheers, > Keith > > ------------------------------ > Research Associate > Department of Computer Science > Vassar College > Poughkeepsie, NY > >
