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
Each record type type has the following associated bindings:
is a variable bound to the record-type descriptor for type. The record-type descriptor may be used as a specializer in SOS method definitions, which greatly simplifies code to dispatch on these types.
is a predicate for records of type type. It accepts one
argument, which can be any object, and returns
#t if the object
is a record of this type, or
is a constructor for records of type type. It accepts one argument for each field of type, in the same order that they are written in the type description, and returns a newly-allocated record of that type.
is an accessor procedure for the field field in records of type type. It accepts one argument, which must be a record of that type, and returns the contents of the corresponding field in the record.
is a modifier procedure for the field field in records of type type. It accepts two arguments: the first must be a record of that type, and the second is a new value for the corresponding field. The record’s field is modified to have the new value.
xml-document record is the top-level record representing a
complete XML document. Declaration is either an
xml-declaration object or
#f. Dtd is either an
xml-dtd object or
#f. Root is an
object. Misc-1, misc-2, and misc-3 are lists of
miscellaneous items; a miscellaneous item is either an
xml-comment object, an
or a string of whitespace.
xml-declaration record 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
xml-element record 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, an
xml-element record or an
xml-processing-instructions record 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).
xml-dtd record represents a document type declaration. The
root field is an XML name for the root element of the
document. External is either an
#f. Internal is a list of DTD element
The remaining record types are valid only within a DTD.
xml-!element record 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:
xml-!attlist record 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
(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
Default describes the default value for the attribute, and can have one of the following values:
xml-!entity record represents a general entity declaration.
Name is an XML name for the entity. Value is the
entity’s value, either a string or an
xml-parameter-!entity record represents a parameter entity
declaration. Name is an XML name for the entity.
Value is the entity’s value, either a string or an
xml-unparsed-!entity record represents an unparsed entity
Name is an XML name for the entity.
Id is an
xml-external-id record. Notation is an
XML name for the notation.
xml-!notation record represents a notation declaration.
Name is an XML name for the notation. Id is an
xml-external-id record 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.