O'Reilly logo

Programming Groovy 2 by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required