Learn R Programming

XiMpLe (version 0.11-3)

XiMpLe.validity,-class: Class XiMpLe.validity

Description

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

Usage

is.XiMpLe.validity(x)

Arguments

x

An arbitrary R object.

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.

Details

A contructor function XMLValidity(...) is available to be used instead of new("XiMpLe.validity", ...).

See Also

validXML

Examples

Run this code
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  node can have the "foo"
# attribute only below an  node; the  node is also only valid
# in an  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")
   )
 )

Run the code above in your browser using DataLab