inst/examples/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))

Try the XML package in your browser

Any scripts or data that you put into this service are public.

XML documentation built on Nov. 3, 2023, 1:14 a.m.