EVOLUTION-MANAGER
Edit File: xmlParseDoc.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: Parse an XML document with options controlling the parser.</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 xmlParseDoc {XML}"><tr><td>xmlParseDoc {XML}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Parse an XML document with options controlling the parser.</h2> <h3>Description</h3> <p>This function is a generalization of <code><a href="xmlTreeParse.html">xmlParse</a></code> that parses an XML document. With this function, we can specify a combination of different options that control the operation of the parser. The options control many different aspects the parsing process </p> <h3>Usage</h3> <pre> xmlParseDoc(file, options = 1L, encoding = character(), asText = !file.exists(file), baseURL = file) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>file</code></td> <td> <p>the name of the file or URL or the XML content itself</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>options controlling the behavior of the parser. One specifies the different options as elements of an integer vector. These are then bitwised OR'ed together. The possible options are <code>RECOVER</code>, <code>NOENT</code>, <code>DTDLOAD</code>, <code>DTDATTR</code>, <code>DTDVALID</code>, <code>NOERROR</code>, <code>NOWARNING</code>, <code>PEDANTIC</code>, <code>NOBLANKS</code>, <code>SAX1</code>, <code>XINCLUDE</code>, <code>NONET</code>, <code>NODICT</code>, <code>NSCLEAN</code>, <code>NOCDATA</code>, <code>NOXINNODE</code>, <code>COMPACT</code>, <code>OLD10</code>, <code>NOBASEFIX</code>, <code>HUGE</code>, <code>OLDSAX</code>. ( These options are also listed in the (non-exported) variable <code>parserOptions</code>.) </p> </td></tr> <tr valign="top"><td><code>encoding</code></td> <td> <p>character string that provides the encoding of the document if it is not explicitly contained within the document itself.</p> </td></tr> <tr valign="top"><td><code>asText</code></td> <td> <p>a logical value indicating whether <code>file</code> is the XML content (<code>TRUE</code>) or the name of a file or URL (<code>FALSE</code>)</p> </td></tr> <tr valign="top"><td><code>baseURL</code></td> <td> <p>the base URL used for resolving relative documents, e.g. XIncludes. This is important if <code>file</code> is the actual XML content rather than a URL</p> </td></tr> </table> <h3>Value</h3> <p>An object of class <code>XMLInternalDocument</code>. </p> <h3>Author(s)</h3> <p>Duncan Temple Lang</p> <h3>References</h3> <p>libxml2</p> <h3>See Also</h3> <p><code><a href="xmlTreeParse.html">xmlParse</a></code> </p> <h3>Examples</h3> <pre> f = system.file("exampleData", "mtcars.xml", package="XML") # Same as xmlParse() xmlParseDoc(f) txt = '<top xmlns:r="http://www.r-project.org"> <b xmlns:r="http://www.r-project.org"> <c xmlns:omg="http:/www.omegahat.net"/> </b> </top>' xmlParseDoc(txt, NSCLEAN, asText = TRUE) txt = '<top xmlns:r="http://www.r-project.org" xmlns:r="http://www.r-project.org"> <b xmlns:r="http://www.r-project.org"> <c xmlns:omg="http:/www.omegahat.net"/> </b> </top>' xmlParseDoc(txt, c(NSCLEAN, NOERROR), asText = TRUE) </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>