groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Fwd: Delete Sub Child XML Nodes
Date Wed, 24 Aug 2016 23:06:07 GMT
I forwarded your email to the users list since it isn't about
development of the language codebase itself but rather about using

Cheers, Paul.

---------- Forwarded message ----------
From: GroovyBeginner <>
Date: Thu, Aug 25, 2016 at 12:51 AM
Subject: Delete Sub Child XML Nodes

I am unable to delete the sub child xml Nodes. Here is the input and code am
trying with

import groovy.xml.*;
def employees='''<Employees>
def fields = ['Name','ZipCode']
def xml = new XmlParser().parseText(employees)
xml.Employee.each { node ->
        if(!fields.contains( {


How to delete the node ZipCode from the xml?

View this message in context:
Sent from the Groovy Dev mailing list archive at

View raw message