Home > Articles > Web Services > XML

Exploring the XML Infoset

  • Print
  • + Share This
Ken Sall explains the XML Information Set, which is used for describing the common set of items that are relevant across many XML specifications.
This chapter is from the book

XML Information Set, often called simply Infoset, is an attempt to define a set of terms that other W3C specifications (and presumably specs from other organizations) can use to refer to the information chunks in a well-formed (but not necessarily valid) XML document. The Infoset is partly defined by what it isn't as well; it does not attempt to define a complete set of information, nor does it represent the minimal information that an XML processor should return to an application. The initial working draft was published in May 1999; XML Information Set became a W3C Recommendation in October 2001, located at http://www.w3.org/TR/xml-infoset/.

An information set is the collection of information items of a particular XML document. An information item is an abstract model of a portion of an XML document that is characterized by certain properties, denoted in bold, square brackets in the spec (e.g., [children]). Some properties are characteristic of more than one kind of information item (e.g., [local name] applies to element and attribute information items), while others are unique to a specific information item type (e.g., [document element] applies only to the document information item). There are eleven kinds of information items, described in the next subsection "What's In the Infoset?"

While valid documents also may have an information set, any document that is well-formed and meets XML namespace constraints described in the Infoset specification has an information set. Documents that do not conform to the Namespaces in XML Recommendation cannot have meaningful information sets, even though they may be well-formed. In cases where an XML processor, especially a validating parser, expands entity references, there are information items that contain the replacement text. Since a nonvalidating parser is not required1 to do this expansion, there is a special information item called an unexpanded entity reference information item.

Conformance with the XML Information Set specification is really a matter of concern for the other specifications that use Infoset definitions. Specifications that reference the Infoset must:

  • Indicate which information items and properties they support.

  • Specify whether information items and properties are passed through unchanged to the application or how they are modified.

  • Specify additional information they consider significant that is not defined by the Infoset.

  • Designate any departure from Infoset terminology (which is discouraged).

What's in the Infoset?

The eleven information items described by the Infoset are shown in Table 5-2. For each, a representative sample of properties is listed. Refer to the specification for details and a complete list of properties and more detailed descriptions.

TABLE 5-2 Information Items and Selected Properties


Description and Selected Properties in [ ]

Document Information Item

There is always exactly one document information item, which is the single root from which all other information items are accessible (directly or indirectly) via properties. Note: This is not the item corresponding to the document element, although that element is one of the properties of this item. Properties mainly pertain to the XML prolog, including [children], [document element], [base URI], [character encoding scheme], [version] and [standalone]. The [document element] property identifies the unique document element, which is the root of all elements in the document. The [children] property is an ordered list of information items containing one element (the document element), plus one information item for each processing instruction or comment that appears outside the document element. If there is a document type declaration, then one child is the document type declaration information item described later in this table.

Element Information Items

There is one element information item for each element in the document, including one for the unique document element, through whose [children] property all other elements are reachable. Properties include [namespace name], a URI or possibly no value,a [local name], [prefix], [children], an ordered list in document order of element, processing instruction, unexpanded entity reference, character, and comment information items that are immediate children, [attributes], an unordered possibly empty set, [namespace attributes], [in-scope namespaces], [base URI], and [parent].

Attribute Information Items

There is one attribute information item for each attribute of each element, including any attributes from the DTD with default values that are not explicit in the XML document. Properties include [namespace name], [local name], [prefix], [normalized value], [specified], a flag designating

Attribute Information Items (continued)

whether the attribute was explicit in the owner element's start tag, [attribute type], one of the 10 values such as ID, IDREF, CDATA, NMTOKEN, ENUMERATION, [references], meaningful only for certain attribute types such as IDREF or ENTITY, and [owner element], the element whose start tag contains the attribute.

Processing Instruction Information Items

There is one of these for each PI. The XML declaration is not considered a processing instruction. Properties include [target], the application to receive the data, [content], the PI's data such as name/value pairs, and [parent], the item that contains this item in its [children] property.

Unexpanded Entity Reference Information Items

Items of this type serve as placeholders for XML processors (primarily nonvalidating parsers) to indicate which external parsed entities have not been expanded. Properties include [name], the entity referenced, [system identifier], and [public identifier].

Character Information Items

There is a character information item for each character in the document, although applications are free to combine contiguous characters. This applies to #PCDATA content of elements, CDATA sections, and character entity references. Properties include [character code], [element content whitespace], a flag indicating true if the character is white space within element content, and [parent], which is always an element information item.

Comment Information Items

There is one of these for each comment in the instance document, but not for comments in the DTD. Properties are [content] and [parent].

Document Type Declaration Information Item

There is at most one document type declaration information item, if and only if the document has a document type declaration. Properties are [system identifier] of the external subset (if any), [public identifier] of the external subset (if any), [children], which in this context is the ordered list of processing instructions from the DTD, and [parent], the document information item that contains this item.

Unparsed Entity Information Items

This information item pertains to unparsed general entities declared in the DTD, which relate to notations. Properties include [name], [system identifier], [public identifier], [notation name], and [notation].

Notation Information Items

This information item applies to notations declared in the DTD, used to represent binary data (e.g., images) or other non-XML data. Properties include [name], [system identifier], and [public identifier].

Namespace Information Items

Each element has a namespace information item for every in-scope namespace, identified by the [in-scope namespaces] property of the element information item. Properties are [prefix], the portion that follows xmlns: prefix (or no value if the attribute name is xmlns denoting the default namespace) and [namespace name], the URI to which the prefix is bound. Namespace information items are what we have called xmlns attributes earlier in this chapter.

  • + Share This
  • 🔖 Save To Your Account