XML - Element Content

> Markup Language (ML) > Extensible Markup Language (XML)

1 - About

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)

Advertising

3 - Model

3.1 - Empty

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" />
<br></br>
<br/>

3.2 - 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.

Advertising

3.3 - Not Mixed (CDATA)

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

See XML - Character data (CDATA)

3.4 - Element

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

markup/xml/content.txt · Last modified: 2019/02/09 11:29 by gerardnico