[arch-projects] XML holocaust

Dusty Phillips buchuki at gmail.com
Sat Mar 19 13:11:03 EST 2005

Was wondering if anybody here actually *likes* XML. You'll probably be
shocked to find out I can't stand the language, since Java programmers
seem to be inextricably married to the language. In fact, the link to
XML, and not Java itself is what often makes me feel embarrassed to be
a Java programmer!

Enter Groovy. Between GPath/XmlSlurp
(http://groovy.codehaus.org/GPath) and
GroovyMarkup(http://groovy.codehaus.org/GroovyMarkup), I'm finding
that its practically painless to interface to XML coming and going.
While working on the weather applet yesterday, I found that I could
read the weather.com XML file using dot syntax _without having to
parse it_.  I've also experimented with GroovyMarkup and the XML
builder. Again, you can use dot syntax and basic Groovy/Java code to
create an XML file, and can also use typical programming language
constructs (loops, conditionals) to simplify the task.

Ok, you can probably do similar stuff with Python, Ruby, or any other
scripting langugae. If you can't somebody should write a module that
does it. ;-)

Being able to ignore/abstract XML is great, but I started thinking it
should be possible in some cases to completely discard it. My first
example is ant. Those who don't code Java probably still use make
(with the antiquated Makefile syntax), or that neat Python
distribution tool, or something similar. or dissimilar. In my case,
I've been taught to use ant. I hate the XML build files. Groovy allows
me to script ant, but I figure I should be able to ignore the ant
dependency and write a build toolkit in Java and Groovy.  Haven't
thought about it much, but I'm thinking each target could be a Groovy
closure. The build file is a groovy script that extends a Java (or
Groovy) class and manages a bunch of closures/targets in some way.

That will probably be my next project. :-D

Another item is TestNG. This was a framework that I chose to never use
because of the XML scripts, its supposed to be the 'next generation'
to JUnit tests. (http://www.beust.com/testng/). I have issues with
JUnit though. I'm thinking I can do the same thing and overcome
TestNG's "limitation" (XML) by writing test framework in groovy.
Happily, this has already been done
(http://groovy.codehaus.org/Unit+Testing). But I like TestNG's
annotation-based configuration, so maybe someday I'll expand the
Groovy Unit Testing to include that. It could happen.

I'm also thinking of ways to code XHTML in GroovyMarkup so I never
have to look at another angle bracket ever again!

Thoughts? Anybody want to defend XML?


More information about the arch-projects mailing list