More than one rule can be created
and passed in an array as the argument of the constructor and the validation check is successful if at
least one of those rules is validated correctly. The constructor has the following signature:
RChoice( choices:Array < Rule > );
The following rule defines a validation rule for an element that has the name items and that contains
zero or more elements with the names movie , book , or magazine .
var schema = RNode(???items???,
RMulti(RChoice([
RNode(???movie???),
RNode(???book???),
RNode(???magazine???)])));
The following XML document is valid for the preceding rule:
< items > < book/ > < movie/ > < book/ > < /items >
The following document is not valid because the toy element has no matching rule:
< items > < book/ > < toy/ > < /items >
RO ptional
The ROptional constructor is not a surprise; the rule passed as an argument is applied only if a
matching node or set of nodes exists; otherwise it is skipped. The constructor has the following signature:
ROptional( rule:Rule );
The following validation rule defines that the items element must contain two elements, movie and
book , in any order where the movie element is optional.
Pages:
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855