8.1 Parsing XML
In Groovy we can use the Java-based parsing approaches and tools we are already familiar with if we have some special need or reasons to depend on the older APIs or have legacy code that already uses them. If we have working Java code to parse XML documents, we can reuse those readily in Groovy. Groovy does not force us to duplicate our efforts.
If we’re creating new code to parse XML, though, we can benefit from the Groovy facilities.
On a recent project, I had to populate an application with data from some 400 XML documents. At first glance, that task was intimidating; the sheer volume of files to deal with was enough to dissuade me. After quickly browsing through several files, I decided to use Groovy to process the files, ...
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