ElementDecl(p, name$, type, quantifier, children)
name$
parameter. If type
equals #XML_CTYPE_EMPTY
or #XML_CTYPE_ANY
, then
quantifier
will be #XML_CQUANT_NONE
, and the children
table will be Nil
.
If type
is #XML_CTYPE_MIXED
, then quantifier
will be #XML_CQUANT_NONE
or #XML_CQUANT_REP
and the
children
table will contain the elements that are allowed to be mixed in. All those children
will have type #XML_CTYPE_NAME
with no quantification then. Only the root node can be of type
#XML_CTYPE_EMPTY
, #XML_CTYPE_ANY
, or #XML_CTYPE_MIXED
.
For type #XML_CTYPE_NAME
, the name$
parameter will contain the name and the children
table will be
Nil
. The quantifier
parameter will indicate any quantifiers placed on the name.
Types #XML_CTYPE_CHOICE
and #XML_CTYPE_SEQ
indicate a choice or sequence respectively. The children
table
then contains the nodes in the choice or sequence.
The children passed in the children
table will have the fields name
, type
, quantifier
, and children
set. They correspond to the parameters of the same name passed to ElementDecl()
.
Possible values for the type
parameter/field:
#XML_CTYPE_EMPTY #XML_CTYPE_ANY #XML_CTYPE_MIXED #XML_CTYPE_NAME #XML_CTYPE_CHOICE #XML_CTYPE_SEQ |
Possible values for the quantifier
parameter/field:
#XML_CQUANT_NONE #XML_CQUANT_OPT #XML_CQUANT_REP #XML_CQUANT_PLUS |
Nil
Function p_ElementDecl(p, elname$, type, quant, children) DebugPrint(elname$, type, quant, children) EndFunction p = xml.CreateParser({ElementDecl = p_ElementDecl}) p:Parse([[ <!DOCTYPE student [ <!ELEMENT student (id|surname)> <!ELEMENT id (#PCDATA)> ]> <student> <id>9216735</id> </student> ]]) p:Free()The code above shows how to handle attlist declarations.