top = newXMLNode("doc")
s = newXMLNode("section", attr = c(title = "Introduction"))
a = newXMLNode("article", s)
addChildren(top, a)
xmlName(xmlParent(s))
xmlName(xmlParent(xmlParent(s)))
# Find the root node.
root = a
while(!is.null(xmlParent(root)))
root = xmlParent(root)
# find the names of the parent nodes of each 'h' node.
# use a global variable to "simplify" things and not use a closure.
filename = system.file("exampleData", "branch.xml", package = "XML")
parentNames <- character()
xmlTreeParse(filename,
handlers =
list(h = function(x) {
parentNames <<- c(parentNames, xmlName(xmlParent(x)))
}), useInternalNodes = TRUE)
table(parentNames)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.