Revision: 3803
Updated Code
at September 14, 2007 18:04 by jsbournival
Updated Code
import org.dom4j.io.*
import org.dom4j.*
new File('in/emissions').eachFile{ file ->
if (!file.name.endsWith('.xml'))
return
def emission = new SAXReader().read(file).rootElement
def sondage = emission.addElement('pr:sondage')
sondage.addAttribute('xsi:nil', 'true')
sondage.setText('n/a')
def writer = new FileWriter('out/' + file.name)
XMLWriter output = new XMLWriter(writer, OutputFormat.createPrettyPrint())
output.writeNode(emission)
output.close()
}
Revision: 3802
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 14, 2007 18:03 by jsbournival
Initial Code
import org.dom4j.io.*
import org.dom4j.*
new File('in/emissions').eachFile{ file ->
if (!file.name.endsWith('.xml'))
return
def emission = new SAXReader().read(file).rootElement
def sondage = emission.addElement('pr:sondage')
sondage.addAttribute('xsi:nil', 'true')
sondage.setText('n/a')
def writer = new FileWriter('out/' + file.name)
XMLWriter output = new XMLWriter(writer, OutputFormat.createPrettyPrint())
output.writeNode(emission)
output.close()
}
Initial URL
http://www.dom4j.org/guide.html
Initial Description
Initial Title
Modifying XML file structure (Groovy)
Initial Tags
groovy
Initial Language
Groovy