XiMpLe.validity,-class {XiMpLe} | R Documentation |
Class XiMpLe.validity
Description
Used for objects that describe valid child nodes and attributes of XiMpLe_node
s.
Usage
is.XiMpLe.validity(x)
Arguments
x |
An arbitrary |
Details
A contructor function XMLValidity(...)
is available to be used instead of new("XiMpLe.validity",
...)
.
Slots
children
Named list of vectors or XiMpLe.validity objects. The element name defines the parent node name and each character string a valid child node name. If a value is in turn of class XiMpLe.validity, this object will be used for recursive validation of deeper nodes.
attrs
Named list of character vectors. The element name defines the parent node name and each character string a valid attribute name.
allChildren
Character vector, names of globally valid child nodes for all nodes, if any.
allAttrs
Character vector, names of globally valid attributes for all nodes, if any.
empty
Character vector, names of nodes that must be empty nodes (i.e., no closing tag), if any.
ignore
Character vector, names of nodes that should be ignored, if any.
See Also
Examples
HTMLish <- XMLValidity(
children=list(
body=c("a", "p", "ol", "ul", "strong"),
head=c("title"),
html=c("head", "body"),
li=c("a", "br", "strong"),
ol=c("li"),
p=c("a", "br", "ol", "ul", "strong"),
ul=c("li")
),
attrs=list(
a=c("href", "name"),
p=c("align")
),
allChildren=c("!--"),
allAttrs=c("id", "class"),
empty=c("br")
)
# this example uses recursion: the <b> node can have the "foo"
# attribute only below an <a> node; the <d> node is also only valid
# in an <a> node
XMLRecursion <- XMLValidity(
children=list(
a=XMLValidity(
children=list(
b=c("c")
),
attrs=list(
b=c("foo")
),
allChildren=c("d")
)
),
attrs=list(
b=c("bar")
)
)