AttlistDecl(p, elname$, attname$, atttype$, dflt$, isrequired)
elname$ parameter returns the name of the element for which the attribute is being
declared. The attribute name is in the attname$ parameter. The attribute type is in the atttype$
parameter. It is the string representing the type in the declaration with whitespace removed.
The dflt$ parameter holds the default value. It will be Nil in the case of #IMPLIED or #REQUIRED
attributes. You can distinguish these two cases by checking the isrequired parameter, which will be
True in the case of #REQUIRED attributes. Attributes which are #FIXED will have also have a True
isrequired, but they will have the non-Nil fixed value in the dflt parameter.
True or False depending on whether the attribute is required
Function p_AttlistDecl(p, elname$, attname$, atttype$, dflt$, isreq)
DebugPrint(elname$, attname$, atttype$, dflt$, isreq)
EndFunction
p = xml.CreateParser({AttlistDecl = p_AttlistDecl})
p:Parse([[
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE lab_group [
<!ELEMENT student_name (#PCDATA)>
<!ATTLIST student_name student_no ID #REQUIRED>
<!ATTLIST student_name tutor_1 IDREF #IMPLIED>
<!ATTLIST student_name tutor_2 IDREF #IMPLIED>
]>
<root/>
]])
p:Free()
The code above shows how to handle attlist declarations.