Previous: XML Names, Up: XML Support
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-document
record is the top-level record representing a complete XML document. Declaration is either anxml-declaration
object or#f
. Dtd is either anxml-dtd
object or#f
. Root is anxml-element
object. Misc-1, misc-2, and misc-3 are lists of miscellaneous items; a miscellaneous item is either anxml-comment
object, anxml-processing-instructions
object, or a string of whitespace.
The
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"yes"
,"no"
, or#f
.
The
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, anxml-element
record or anxml-processing-instructions
record.
The
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).
The
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 anxml-external-id
record 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-!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:
- 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-!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 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-!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 anxml-external-id
record.
The
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 anxml-external-id
record.
The
xml-unparsed-!entity
record represents an unparsed entity declaration.Name
is an XML name for the entity. Id is anxml-external-id
record. Notation is an XML name for the notation.
The
xml-!notation
record represents a notation declaration.Name
is an XML name for the notation. Id is anxml-external-id
record.
The
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.