XiMpLe.validity-class: Class XiMpLe.validity

XiMpLe.validity,-classR Documentation

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.

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

validXML

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")
   )
 )

XiMpLe documentation built on Aug. 22, 2023, 5:07 p.m.