XiMpLe.validity-class: Class XiMpLe.validity

Description Usage Arguments Details Slots See Also Examples

Description

Used for objects that describe valid child nodes and attributes of XiMpLe.nodes.

Usage

1

Arguments

x

An arbitrary R object.

Details

You should use XMLValidity to create objects of this class.

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

XMLValidity, validXML

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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")
   )
 )

XiMpLe documentation built on Dec. 13, 2017, 1:04 a.m.