Learn R Programming

XiMpLe (version 0.11-3)

XMLTree: Constructor function for XiMpLe.doc objects

Description

Can be used to create full XML trees.

Usage

XMLTree(..., xml = NULL, dtd = NULL, .children = list(...))

Value

An object of class XiMpLe_doc

Arguments

...

Optional children for the XML tree. Must be either objects of class XiMpLe_node or character strings, which are treated as simple text values.

xml

A named list, XML declaration of the XML tree. Currently just pasted, no checking is done.

dtd

A named list, doctype definition of the XML tree. Valid elements are doctype (root element), decl ("PUBLIC" or "SYSTEM"), id (the identifier) and refer (URI to .dtd). Currently just pasted, no checking is done.

.children

Alternative way of specifying children, if you have them already as a list.

See Also

XMLNode, pasteXML

Examples

Run this code
sample.XML.a <- XMLNode("a",
  attrs=list(href="http://example.com", target="_blank"),
  .children="klick here!")
sample.XML.body <- XMLNode("body", .children=list(sample.XML.a))
sample.XML.html <- XMLNode("html", .children=list(XMLNode("head", ""),
  sample.XML.body))
sample.XML.tree <- XMLTree(sample.XML.html,
  xml=list(version="1.0", encoding="UTF-8"),
  dtd=list(doctype="html", decl="PUBLIC",
    id="-//W3C//DTD XHTML 1.0 Transitional//EN",
    refer="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"))

Run the code above in your browser using DataLab