XML - Element Content


The text between a start-tag and a end-tag is called the element's content.

See also: HTML - (Content of an element|Content Model)



An element with no content is said to be empty. The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag.

Examples of empty elements:

<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" />

Mixed (PCDATA)

An element has mixed content when elements of that type contain:

See XML - Parsed Character Data (PCDATA)

Text and elements can be freely intermixed in a DOM hierarchy. That kind of structure is called mixed content in the DOM model.

Mixed content occurs frequently in documents. For example, suppose you wanted to represent this structure:

<sentence>This is an <bold>important</bold> idea.</sentence>

The hierarchy of DOM nodes would look something like this, where each line represents one node:

ELEMENT: sentence
   + TEXT: This is an
   + ELEMENT: bold
     + TEXT: important
   + TEXT: idea.

It is the intermixing of text and elements that defines the mixed-content model.

Not Mixed (CDATA)

An element has a not mixed content when elements of that type contain only character data.

See XML - Character data (CDATA) - Escape


An element type has “element content” when elements of that type MUST contain only child elements (no character data), optionally separated by white space.

Powered by ComboStrap