Learn R Programming

XML (version 0.7-1)

newXMLDoc: Create internal XML node or document object

Description

These are used to create internal `libxml' nodes and top-level document objects that are used to write XML trees. While the functions are available, their direct use is not encouraged. Instead, use xmlTree as the functions need to be used within a strict regime to avoid corrupting C level structures.

Usage

newXMLDoc(dtd, namespaces=NULL)
newXMLNode(name, ..., attrs = NULL, namespace="", doc=NULL)

Arguments

dtd
the name of the DTD to use for the XML document.
namespaces
a named character vector with each element specifying a name space identifier and the corresponding URI for that namespace that are to be declared and used in the XML document, e.g c(shelp="http://www.omegahat.org/XML/SHelp")
name
the tag/element name for the XML node
...
the children of this node. These can be other nodes created earlier or R strings that are converted to text nodes and added as children to this newly created node.
attrs
a named list of name-value pairs to be used as attributes for the XML node.
namespace
the short or alias for the namespace to use for this XML node
doc
the XMLInternalDocument object created with newXMLDoc that is used to root the node.

Value

  • Each function returns an R object that points to the C-level structure instance. These are of class XMLInternalDocument and XMLInternalNode, respectively

Details

These create internal C level objects/structure instances that can be added to a libxml DOM and subsequently inserted into other document objects or ``serialized'' to textual form.

References

http://www.w3.org/XML, http://www.xmlsoft.org, http://www.omegahat.org

See Also

xmlTree saveXML