I'm using the "XML" package and specifically the saveXML() function but I can't 
get the "prefix" argument of saveXML() to work:

library("XML")
concepts <- c("one", "two", "three")
info <- c("info one", "info two", "info three")
root <- newXMLNode("root")
for (i in 1:length(concepts)) {
        cur.concept <- concepts[i]
        cur.info <- info[i]
        cur.tip <- newXMLNode("tip", attrs = c(id = i), parent = root)
        newXMLNode("h1", cur.concept, parent = cur.tip)
        newXMLNode("p", cur.info, parent = cur.tip)
}

# None of the following output a prefix on the first line of the exported 
document
saveXML(root)
saveXML(root, file = "test.xml")
saveXML(root, file = "test.xml", prefix = '<?xml version="1.0"?>\n')

Am I missing something obvious? Any ideas?

Thanks in advance. Earl Brown

-----
Earl K. Brown, PhD
Assistant Professor of Spanish Linguistics
Advisor, TEFL MA Program
Department of Modern Languages
Kansas State University
www-personal.ksu.edu/~ekbrown

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to