XML Infoset Element Children Property Explained
This article provides an overview of the [children]
property of an element information item within the W3C XML Information
Set (Infoset) specification. It defines what the [children]
property is, details the specific types of information items it
contains, explains how document order is preserved, and highlights
important distinctions regarding what is excluded from this list.
Definition of the [children] Property
In the W3C XML Information Set standard, an XML document is modeled
as an abstract tree of “information items.” An element
information item represents an XML element within the document.
The [children] property of an element information item is
an ordered list containing all the information items that appear
directly inside that element’s opening and closing tags.
Items Included in the [children] List
The [children] property maintains document order and can
include the following types of information items:
- Element Information Items: Any child elements nested directly within the parent element.
- Character Information Items: Every character of text content contained directly within the element, including whitespace, unless stripped by an application.
- Comment Information Items: Any XML comments
(
<!-- ... -->) appearing directly inside the element. - Processing Instruction Information Items: Any
processing instructions (
<?target ...?>) contained directly within the element. - Unexpanded Entity Reference Information Items: References to external or unparsed entities that were not expanded during processing.
If an element is empty (such as <example/> or
<example></example>), its
[children] property contains an empty list.
Items Excluded from the [children] List
Certain components of an XML element are handled via distinct
properties rather than the [children] property:
- Attributes: Attributes do not appear in the
[children]list. Instead, they are represented in the[attributes]property as an unordered set of attribute information items. - Namespace Declarations: Namespaces are recorded
separately in properties such as
[in-scope namespaces]and[namespace attributes]. - Document-Level Declarations: The XML declaration and Document Type Definition (DTD) reside outside element content and are associated with the document information item.