| XMLName {XiMpLe} | R Documentation |
Getter/setter methods for S4 objects of XiMpLe XML classes
Description
Used to get/set certain slots from objects of class XiMpLe_doc
and XiMpLe_node.
Usage
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")
Arguments
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 |
Details
These are convenience methods to get or set slots from XML objects without using the @ operator.
XMLName():get/set the XML node name (slot
nameof classXiMpLe_node)XMLAttrs():get/set the XML node attributes (slot
attrsof classXiMpLe_node)XMLValue():get/set the XML node value (slot
valueof classXiMpLe_node)XMLChildren():get/set the XML child nodes (slot
childrenof both classesXiMpLe_nodeandXiMpLe_doc)XMLFile():get/set the XML document file name (slot
fileof classXiMpLe_doc)XMLDecl():get/set the XML document declaration (slot
xmlof classXiMpLe_doc)XMLDTD():get/set the XML document doctype definition (slot
dtdof classXiMpLe_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
nameof both classesXiMpLe_nodeandXiMpLe_doc). Ifas.list=TRUEallways returns a list (or NULL), otherwise if exactly one result is found, it will be returned as as singleXiMpLe_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
findin all slots defined bysearch.
See Also
Examples
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