https://github.com/cran/XML
Raw File
Tip revision: 9ee7aebbd4099fb9a462c14f75a73eb3755b1612 authored by Duncan Temple Lang on 03 October 2007, 00:00:00 UTC
version 1.93-2
Tip revision: 9ee7aeb
wordML.R
library(XML)
      #tt = xmlTree("w:wordDocument", namespaces = c(w = "http://schemas.microsoft.com/office/word/2003/wordml"))
tt = xmlTree(namespaces = c(w = "http://schemas.microsoft.com/office/word/2003/wordml"))

tt$addPI("mso-application", "progid='Word.Document'")
tt$addTag("wordDocument", namespace = "w", close = FALSE)
# XXX if we put this first, we don't get the body. Need to then add the body
# as a sibling of the PI.

v = tt$addTag("w:body",
              tt$addTag("w:p",
                         tt$addTag("w:r",
                                    tt$addTag("w:t", "Hello World!"))))

tt$closeTag()

cat(saveXML(tt))



back to top