Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Here is an example of using StreamingMarkupBuilder to create a new XML file:

Note that StreamingMarkupBuilder.bind returns a

Unknown macro: {http}

instance that may be used to stream the markup to a Writer, in addition to capturing the output in a String (as shown above).
We have used XMLUnit to compare the XML we created with our sample XML. To do this, make sure the sample XML is available, i.e. that the following class is added to your CLASSPATH:

XmlExamples.groovy

Here's another example illustrating how to produce mixed content:

You may also want to see Using MarkupBuilder for Agile XML creation.

  • No labels