The output from the XML parser and the input to the
XML output procedure is a complex data structure composed of
a hierarchy of typed components. Each component is a record whose
fields correspond to parts of the XML structure that the
record represents. There are no special operations on these records;
each is a tuple with named subparts. The root record type is
xml-document, which represents a complete XML
document.
Each record type type has the following associated bindings:
<type>?#t if the object
is a record of this type, or #f otherwise.
make-type-fieldset-type-field!The
xml-documentrecord is the top-level record representing a complete XML document. Declaration is either anxml-declarationobject or#f. Dtd is either anxml-dtdobject or#f. Root is anxml-elementobject. Misc-1, misc-2, and misc-3 are lists of miscellaneous items; a miscellaneous item is either anxml-commentobject, anxml-processing-instructionsobject, or a string of whitespace.
The
xml-declarationrecord represents the ‘<?xml ... ?>’ declaration that optionally appears at the beginning of an XML document. Version is a version string, typically"1.0". Encoding is either an encoding string or#f. Standalone is either"yes","no", or#f.
The
xml-elementrecord represents general XML elements; the bulk of a typical XML document consists of these elements. Name is the element name (an XML name). Attributes is a list of XML attribute objects. Contents is a list of the contents of the element. Each element of this list is either a string, anxml-elementrecord or anxml-processing-instructionsrecord.
The
xml-processing-instructionsrecord represents processing instructions, which have the form ‘<?name ... ?>’. These instructions are intended to contain non-XML data that will be processed by another interpreter; for example they might contain PHP programs. The name field is the processor name (a symbol), and the text field is the body of the instructions (a string).
The
xml-dtdrecord represents a document type declaration. The root field is an XML name for the root element of the document. External is either anxml-external-idrecord or#f. Internal is a list of DTD element records (e.g.xml-!element,xml-!attlist, etc.).
The remaining record types are valid only within a DTD.
The
xml-!elementrecord represents an element-type declaration. Name is the XML name of the type being declared (a symbol). Content-type describes the type and can have several different values, as follows:
- The XML names ‘EMPTY’ and ‘ANY’ correspond to the XML keywords of the same name.
- A list ‘(MIX type ...)’ corresponds to the ‘(#PCDATA | type | ...)’ syntax.
The
xml-!attlistrecord represents an attribute-list declaration. Name is the XML name of the type for which attributes are being declared (a symbol). Definitions is a list of attribute definitions, each of which is a list of three elements(name type default). Name is an XML name for the name of the attribute (a symbol). Type describes the attribute type, and can have one of the following values:
- The XML names ‘CDATA’, ‘IDREFS’, ‘IDREF’, ‘ID’, ‘ENTITY’, ‘ENTITIES’, ‘NMTOKENS’, and ‘NMTOKEN’ correspond to the XML keywords of the same names.
- A list ‘(NOTATION name1 name2 ...)’ corresponds to the ‘NOTATION (name1 | name2 ...)’ syntax.
- A list ‘(ENUMERATED name1 name2 ...)’ corresponds to the ‘(name1 | name2 ...)’ syntax.
Default describes the default value for the attribute, and can have one of the following values:
- The XML names ‘#REQUIRED’ and ‘#IMPLIED’ correspond to the XML keywords of the same names.
- A list ‘(#FIXED value)’ corresponds to the ‘#FIXED "value"’ syntax. Value is represented as a string.
- A list ‘(DEFAULT value)’ corresponds to the ‘"value"’ syntax. Value is represented as a string.
The
xml-!entityrecord represents a general entity declaration. Name is an XML name for the entity. Value is the entity's value, either a string or anxml-external-idrecord.
The
xml-parameter-!entityrecord represents a parameter entity declaration. Name is an XML name for the entity. Value is the entity's value, either a string or anxml-external-idrecord.
The
xml-unparsed-!entityrecord represents an unparsed entity declaration.Nameis an XML name for the entity. Id is anxml-external-idrecord. Notation is an XML name for the notation.
The
xml-!notationrecord represents a notation declaration.Nameis an XML name for the notation. Id is anxml-external-idrecord.
The
xml-external-idrecord is a reference to an external DTD. This reference consists of two parts: id is a public ID literal, corresponding to the ‘PUBLIC’ keyword, while uri is a system literal, corresponding to the ‘SYSTEM’ keyword. Either or both may be present, depending on the context. Id is represented as a string, while uri is represented as a URI record.