[R] How to modify XML documents and save changes

Steffen Durinck steffen.durinck at esat.kuleuven.ac.be
Tue Feb 25 11:46:02 CET 2003


Dear,

I want to read XML documents, add child nodes to some elements and store
everything back as an XML document.

I've tryed the following:

doc <- xmlTreeParse("file.xml")       
QTListNode<-xmlElementsByTagName(xmlRoot(doc)[[1]],"tagname") 
append.xmlNode(QTListNode[[1]],newXMLNode(name ="Norm", attrs = NULL))
saveXML(doc, file = "out.xml", compression = 0, indent=T)

This doesn't seem to work.
Can anyone help?

Thanks,
Steffen




More information about the R-help mailing list