Kimbro recently found that
using JAXP to work with XML in Groovy and Jython was quite painful. I
agree, it can be pretty hard to do basic stuff with JAXP with lots of imports from all kinds of places (JAXP, DOM, SAX etc).
Though it
depends on the library you're using; there's nothing about Java per se that makes it bad for things like XML parsing - its just a question of using the right abstraction or tool.
e.g. here's an example of Kimbro's Groovy script but using dom4j rather
than JAXP which looks about as simple as the python example...
!/usr/bin/env groovy
import org.dom4j.io.SAXReader
doc = new SAXReader().read("config.xml")
results = doc.selectNodes("/blog/base-url")
for (result in results) {
println(result.stringValue)
}
8:36:45 PM
|
|