Andrey Hihlovskiy

Professional blog on groovy, gradle, Java, Javascript and other stuff.

groovy XmlParser and XmlSlurper

I am absolutely astonished by functionality of groovy classes XmlParser and XmlSlurper. The both are similar to each other, with one important difference: XmlParser is more DOM-like (all data in memory), while XmlSlurper is more SAX-like (data parsing delayed until needed).
The most charming thing is how both work together with closures, regexps and collection methods. I am seriously thinking about shifting all XML-specific code to these facilities.

http://groovy.codehaus.org/Reading+XML+using+Groovy%27s+XmlParser

http://groovy.codehaus.org/Reading+XML+using+Groovy%27s+XmlSlurper

Advertisements

One response to “groovy XmlParser and XmlSlurper

  1. Stefan October 23, 2014 at 04:05

    It’s in reality a great and useful piece of info. I’m happy that you simply shared
    this helpful info with us. Please keep us informed
    like this. Thank you for sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: