xmlGetAttr(node, name, default = NULL, converter = NULL, namespaceDefinition = character(), addNamespace = length(grep(":", name)) > 0)
default
value.name
given by the user to the name space
definition in the node to ensure they match.
This is important as we might ask for an attribute named
r:width
assuming that the prefix r
corresponded to the
URI http://www.r-project.org
. However, there may
be a name space prefix r
defined on the node that points
to a different URI and so this would be an erroneous match.
xmlAttrs
and so controls whether the resulting
attribute names have the prefix attached.
So one specifies TRUE
for this argument if the attribute identifier
has a namespace prefix.
default
is returned.
xmlAttrs
node <- xmlNode("foo", attrs=c(a="1", b="my name"))
xmlGetAttr(node, "a")
xmlGetAttr(node, "doesn't exist", "My own default value")
xmlGetAttr(node, "b", "Just in case")
Run the code above in your browser using DataLab