EVOLUTION-MANAGER
Edit File: append.XMLNode.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Add children to an XML node</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for append.xmlNode {XML}"><tr><td>append.xmlNode {XML}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Add children to an XML node</h2> <h3>Description</h3> <p>This appends one or more XML nodes as children of an existing node. </p> <h3>Usage</h3> <pre> append.XMLNode(to, ...) append.xmlNode(to, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>to</code></td> <td> <p>the XML node to which the sub-nodes are to be added.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>the sub-nodes which are to be added to the <code>to</code> node. If this is a <code>list</code> of <code>XMLNode</code> objects (e.g. create by a call to <code><a href="../../base/html/lapply.html">lapply</a></code>), then that list is used.</p> </td></tr> </table> <h3>Value</h3> <p>The original <code>to</code> node containing its new children nodes. </p> <h3>Author(s)</h3> <p> Duncan Temple Lang </p> <h3>References</h3> <p><a href="http://www.w3.org/XML">http://www.w3.org/XML</a>, <a href="http://www.jclark.com/xml">http://www.jclark.com/xml</a>, <a href="http://www.omegahat.net">http://www.omegahat.net</a> </p> <h3>See Also</h3> <p><code><a href="AssignXMLNode.html">[<-.XMLNode</a></code> <code><a href="AssignXMLNode.html">[[<-.XMLNode</a></code> <code><a href="xmlSubset.html">[.XMLNode</a></code> <code><a href="xmlSubset.html">[[.XMLNode</a></code> </p> <h3>Examples</h3> <pre> # Create a very simple representation of a simple dataset. # This is just an example. The result is # <data numVars="2" numRecords="3"> # <varNames> # <string> # A # </string> # <string> # B # </string> # </varNames> # <record> # 1.2 3.5 # </record> # <record> # 20.2 13.9 # </record> # <record> # 10.1 5.67 # </record> # </data> n = xmlNode("data", attrs = c("numVars" = 2, numRecords = 3)) n = append.xmlNode(n, xmlNode("varNames", xmlNode("string", "A"), xmlNode("string", "B"))) n = append.xmlNode(n, xmlNode("record", "1.2 3.5")) n = append.xmlNode(n, xmlNode("record", "20.2 13.9")) n = append.xmlNode(n, xmlNode("record", "10.1 5.67")) print(n) ## Not run: tmp <- lapply(references, function(i) { if(!inherits(i, "XMLNode")) i <- xmlNode("reference", i) i }) r <- xmlNode("references") r[["references"]] <- append.xmlNode(r[["references"]], tmp) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>XML</em> version 3.99-0.3 <a href="00Index.html">Index</a>]</div> </body></html>