xmlParseDoc | R Documentation |
This function is a generalization of xmlParse
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
xmlParseDoc(file, options = 1L, encoding = character(),
asText = !file.exists(file), baseURL = file)
file |
the name of the file or URL or the XML content itself |
options |
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
|
encoding |
character string that provides the encoding of the document if it is not explicitly contained within the document itself. |
asText |
a logical value indicating whether |
baseURL |
the base URL used for resolving relative documents,
e.g. XIncludes. This is important if |
An object of class XMLInternalDocument
.
Duncan Temple Lang
libxml2
xmlParse
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.