XMLName | R Documentation |
Used to get/set certain slots from objects of class XiMpLe_doc
and XiMpLe_node
.
XMLName(obj) ## S4 method for signature 'XiMpLe_node' XMLName(obj) XMLName(obj) <- value ## S4 replacement method for signature 'XiMpLe_node' XMLName(obj) <- value XMLAttrs(obj) ## S4 method for signature 'XiMpLe_node' XMLAttrs(obj) XMLAttrs(obj) <- value ## S4 replacement method for signature 'XiMpLe_node' XMLAttrs(obj) <- value XMLChildren(obj) ## S4 method for signature 'XiMpLe_node' XMLChildren(obj) ## S4 method for signature 'XiMpLe_doc' XMLChildren(obj) XMLChildren(obj) <- value ## S4 replacement method for signature 'XiMpLe_node' XMLChildren(obj) <- value ## S4 replacement method for signature 'XiMpLe_doc' XMLChildren(obj) <- value XMLValue(obj) ## S4 method for signature 'XiMpLe_node' XMLValue(obj) XMLValue(obj) <- value ## S4 replacement method for signature 'XiMpLe_node' XMLValue(obj) <- value XMLFile(obj) ## S4 method for signature 'XiMpLe_doc' XMLFile(obj) XMLFile(obj) <- value ## S4 replacement method for signature 'XiMpLe_doc' XMLFile(obj) <- value XMLDecl(obj) ## S4 method for signature 'XiMpLe_doc' XMLDecl(obj) XMLDecl(obj) <- value ## S4 replacement method for signature 'XiMpLe_doc' XMLDecl(obj) <- value XMLDTD(obj) ## S4 method for signature 'XiMpLe_doc' XMLDTD(obj) XMLDTD(obj) <- value ## S4 replacement method for signature 'XiMpLe_doc' XMLDTD(obj) <- value XMLScan(obj, name, as.list = FALSE) ## S4 method for signature 'XiMpLe_node' XMLScan(obj, name, as.list = FALSE) ## S4 method for signature 'XiMpLe_doc' XMLScan(obj, name, as.list = FALSE) XMLScan(obj, name) <- value ## S4 replacement method for signature 'XiMpLe_node' XMLScan(obj, name) <- value ## S4 replacement method for signature 'XiMpLe_doc' XMLScan(obj, name) <- value XMLScanDeep(obj, find = NULL, search = "attributes") ## S4 method for signature 'XiMpLe_node' XMLScanDeep(obj, find = NULL, search = "attributes") ## S4 method for signature 'XiMpLe_doc' XMLScanDeep(obj, find = NULL, search = "attributes")
obj |
An object of class |
value |
The new value to set. |
name |
Character, name of nodes to scan for. |
as.list |
Logical, if |
find |
Character, name of element to scan for. |
search |
Character, name of the slot to scan, one of |
These are convenience methods to get or set slots from XML objects without using the @
operator.
XMLName()
: get/set the XML node name (slot name
of class XiMpLe_node
)
XMLAttrs()
: get/set the XML node attributes (slot attrs
of class XiMpLe_node
)
XMLValue()
: get/set the XML node value (slot value
of class XiMpLe_node
)
XMLChildren()
: get/set the XML child nodes (slot children
of both classes XiMpLe_node
and XiMpLe_doc
)
XMLFile()
: get/set the XML document file name (slot file
of class XiMpLe_doc
)
XMLDecl()
: get/set the XML document declaration (slot xml
of class XiMpLe_doc
)
XMLDTD()
: get/set the XML document doctype definition (slot dtd
of class XiMpLe_doc
)
Another special method can scan a node/document tree object for appearances of nodes with a particular name:
XMLScan(obj, name,
as.list=FALSE)
: get/set the XML nodes by name (recursively searches slot name
of both classes
XiMpLe_node
and XiMpLe_doc
). If as.list=TRUE
allways returns a list (or NULL),
otherwise if exactly one result is found,
it will be returned as as single XiMpLe_node
.
Finally, there is a method to scan for certain values in XiMpLe objects and just list them. For instance, it can be used to list all instances of a certain attribute type in a document tree:
XMLScanDeep(obj, find,
search="attributes")
: returns all found instances of find
in all slots defined by search
.
node
,
XiMpLe_doc
,
XiMpLe_node
xmlTestNode <- XMLNode("foo", XMLNode("testchild")) XMLName(xmlTestNode) # returns "foo" XMLName(xmlTestNode) <- "bar" XMLName(xmlTestNode) # now returns "bar" # search for a child node XMLScan(xmlTestNode, "testchild") # remove nodes of that name XMLScan(xmlTestNode, "testchild") <- NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.