8.2 Creating XML
When creating business applications, we often have a number of reasons to present data in XML format—as a way to store the state of an application, to communicate with web services, to represent some configuration data, and so on. Whatever the need, Groovy makes it quite easy to create XML documents.
We can use the full power of Java APIs to generate XML. If we have a particular favorite Java-based XML processor, such as Xerces, we can use it with Groovy as well.[28] This might be a good approach if we already have working code in Java to create XML documents in a specific format and want to use it in our Groovy projects.
If we want to create an XML document using a pure-Groovy approach, we can use
GString’s ability to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access