Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

xmlCleanNamespaces

Remove redundant namespaces on an XML document


Description

This is a convenience function that removes redundant repeated namespace definitions in an XML node. It removes namespace definitions in nodes where an ancestor node also has that definition. It does not remove unused namespace definitions.

This uses the NSCLEAN option for xmlParse

Usage

xmlCleanNamespaces(doc, options = integer(), out = docName(doc), ...)

Arguments

doc

either the name of an XML documentor the XML content itself, or an already parsed document

options

options for the XML parser. NSCLEAN is added to this.

...

additional arguments passed to xmlParse

out

the name of a file to which to write the resulting XML document, or an empty character vector or logical value FALSE to avoid writing the new document.

Value

If the new document is written to a file, the name of the file is returned. Otherwise, the new parsed XML document is returned.

Author(s)

Duncan Temple Lang

References

See Also

Examples

f = system.file("exampleData", "redundantNS.xml", package = "XML")
doc = xmlParse(f)
print(doc)
newDoc = xmlCleanNamespaces(f, out = FALSE)

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.