var schema = RNode(???items???, RList([
ROptional(RNode(???movie???)),
RNode(???book???)]));
RD ata
The constructor applies a validation rule on the content of nodes of type CData or PCData . The
validation applied is a Filter rule that is explained later in this chapter. If the filter argument is
Chapter 16: haXe Advanced Topics
461
omitted, and the validator only requires that the node must be of the correct type. The RData constructor
has the following signature:
RData( ?filter:Filter );
The following rule states that the element with the name div must contain some textual data:
var schema = RNode(???div???, RData());
The following XML fragment is valid:
< div > test < /div >
The following two pieces of code are not valid because the first is empty and the second contains an
extra element node:
// empty element
< div/ >
// PCData + Element content
< div > test < span > < /span > < /div >
Checking Attributes
The Attribute enum has only one constructor Att that, as the name suggests, is used to validate a
node attribute.
Pages:
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856