Je travaille sur un document XML avec Groovy et je teste un nœud pour un certain attribut, qui a un préfixe d'espace de nommage. Comment pourrait-il fonctionner:Groovy + XML: gérer les attributs avec Namespace-Prefix
en script groovy:
...
Element.Subelement.each {
if (it.'@type'=='ns2:xyType')
...do what ever...
}
dans le document XML:
<Element>
<Subelement xsi:type="ns2:xyType">
<!-- or another type, want to do something with
subelement only if type is "ns2:xyType" -->
</Subelement>
</Element>
Vous cherchez quelque chose comme:
if (it.'@xsi:type'=='ns2:xyType')
THX Seldon