Learn R Programming

XML (version 3.1-1)

xmlParseDoc: Parse an XML document with options controlling the parser.

Description

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

Usage

xmlParseDoc(file, options = 1L, encoding = character(), asText = !file.exists(file), baseURL = file)

Arguments

Value

  • An object of class XMLInternalDocument.

concept

XML

References

libxml2

See Also

xmlParse

Examples

Run this code
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.org"/>
        </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.org"/>
        </b>
      </top>'

 xmlParseDoc(txt, c(NSCLEAN, NOERROR), asText = TRUE)

Run the code above in your browser using DataLab