Learn R Programming

XML (version 0.7-1)

xmlNode: Create an XML node

Description

These functions allow one to create XML nodes as are created in C code when reading XML documents. Trees of XML nodes can be constructed and integrated with other trees generated manually or with via the parser.

Usage

xmlNode(name, ..., attrs=NULL, namespace="")
xmlTextNode(value, namespace="")
xmlPINode(sys, value, namespace="")
xmlCDataNode(...)
xmlCommentNode(text)

Arguments

name
The tag or element name of the XML node. This is what appears in the elements as ..
...
The children nodes of this XML node. These can be objects of class XMLNode or arbitrary values that will be converted to a string to form an XMLTextNode object.
attrs
A named character vector giving the name, value pairs of attributes for this XML node.
value
This is the text that is to be used when forming an XMLTextNode.
namespace
The XML namespace identifier for this node.
sys
the name of the system for which the processing instruction is targeted. This is the value that appears in the
text
character string giving the contents of the comment.

Value

  • An object of class XMLNode. In the case of xmlTextNode, this also inherits from XMLTextNode. The fields or slots that objects of these classes have include name, attributes, children and namespace. However, one should the accessor functions xmlName, xmlAttrs, xmlChildren and xmlNamespace

References

http://www.w3.org/XML, http://www.jclark.com/xml, http://www.omegahat.org

See Also

xmlTreeParse asXMLNode

Examples

Run this code
a <- xmlNode("arg", attrs = c(default="T"), xmlNode("name", "foo"), xmlNode("defaultValue","1:10"))

Run the code above in your browser using DataLab