1\name{xmlCleanNamespaces} 2\alias{xmlCleanNamespaces} 3\title{Remove redundant namespaces on an XML document} 4\description{ 5 This is a convenience function that removes redundant 6 repeated namespace definitions in an XML node. 7 It removes namespace definitions in nodes 8 where an ancestor node also has that definition. 9 It does not remove unused namespace definitions. 10 11 This uses the \code{NSCLEAN} option for \code{\link{xmlParse}} 12} 13\usage{ 14xmlCleanNamespaces(doc, options = integer(), out = docName(doc), ...) 15} 16\arguments{ 17 \item{doc}{either the name of an XML documentor the XML content 18 itself, or an already parsed document} 19 \item{options}{options for the XML parser. \code{NSCLEAN} is added to this.} 20 \item{\dots}{additional arguments passed to \code{\link{xmlParse}}} 21 \item{out}{the name of a file to which to write the resulting XML 22 document, or an empty character vector or logical value \code{FALSE} 23 to avoid writing the new document. 24 } 25} 26\value{ 27 If the new document is written to a file, the name of the file is 28 returned. 29 Otherwise, the new parsed XML document is returned. 30} 31\references{ 32libxml2 documentation \url{http://xmlsoft.org/html/libxml-parser.html} 33} 34\author{ 35Duncan Temple Lang 36} 37\seealso{ 38\code{\link{xmlParse}} 39} 40\examples{ 41f = system.file("exampleData", "redundantNS.xml", package = "XML") 42doc = xmlParse(f) 43print(doc) 44newDoc = xmlCleanNamespaces(f, out = FALSE) 45} 46\keyword{programming} 47\keyword{IO} 48