I'm using XML Slurper to parse an XML file with this type of format:
<R>
<C0>...</C0>
<C1>...</C1>
<C2>...</C2>
</R>
<R>
<C0>...</C0>
<C1>...</C1>
<C2>...</C2>
</R>
...
The XML file node names are constantly changing so I would like to use a
variable for the node designations.
defreport =newXmlSlurper().parse(myXmlFile)
instead of access the C1 node like:
report.R.each() {item ->
item.C1
}
I'm using:
def myTag = "C1"
report.R.each {item ->
item.getProperty(myTag)
}
Is there a shorter way to access the node by variable without
getProperty(tagVar)?
Thanks,
Carl Marcum
Apache OpenOffice committer and PMC
|