I have the following xml
<group xmlns="http://www.cdisc.org/ns/odm/v1.3">
<item>
<text xml:lang="en">Mild</text>
<text xml:lang="fr">Legere</text>
</item>
<group>
I want to get all the "en" string from the xml. I am parsing it with the following groovy code
def doc = new XmlSlurper().parse(inputstream).declareNamespace(xmlns:'http://www.cdisc.org/ns/odm/v1.3')
List<String> text = []
def s = doc.item.find{ it@":lang" = "en"}.each {
text.add(it.text())
}
println text
The problem is it seams to be ignoring the attribute. I registered the default namespace, i've tried combinations of xml:lang, :lang, lang in the find closure but no joy.
Does any body know what I'm doing wrong.
Thanks