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 3 Next »

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

This will output XML similar to what we have been using in previous examples.

If we want we can take this further and compare what we produced with our sample XML. To do this, make sure the following class is added to your CLASSPATH:


We can now extend the previous example to compare the newly created XML with our sample XML using XMLUnit:

We have a little bit of work to do. By default XMLUnit allows elements and attributes to be reordered and still treats two XML documents as similar but by default it doesn't allow differences in whitespace (hence the IgnoreWhitespaceDifferenceListener).

  • No labels