Modifying XML file structure (Groovy)
Copy this code and paste it in your HTML
if (!file.
name.
endsWith('.xml'))
def emission
= new SAXReader
().
read(file
).
rootElement
def sondage
= emission.
addElement('pr:sondage') sondage.addAttribute('xsi:nil', 'true')
sondage.setText('n/a')
XMLWriter output
= new XMLWriter
(writer, OutputFormat.
createPrettyPrint())
output.writeNode(emission)
}
URL: http://www.dom4j.org/guide.html
Report this snippet
Comments
Subscribe to comments