Stylus Studio XML Editor

Table of contents

Appendices

3.1 Start-Tags, End-Tags, and Empty-Element Tags

Start-Tags, End-Tags, and Empty-Element Tags

The beginning of every non-empty XML element is marked by a start-tag.

Start-tag
3.1    STag   ::=   '<' Name (S Attribute)* S? '>'
3.1    Attribute   ::=   Name Eq AttValue[VC: Attribute Value Type]

The Name in the start- and end-tags gives the element's type. The Name-AttValue pairs are referred to as the attribute specifications of the element, with the Name in each pair referred to as the attribute name and the content of the AttValue (the text between the ' or " delimiters) as the attribute value. Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.

Well Formedness Constraint: Unique Att Spec

Unique Att Spec

An attribute name MUST NOT appear more than once in the same start-tag or empty-element tag.

Validity Constraint: Attribute Value Type

Attribute Value Type

The attribute MUST have been declared; the value MUST be of the type declared for it. (For attribute types, see [Attribute-List Declarations].)

Well Formedness Constraint: No External Entity References

No External Entity References

Attribute values MUST NOT contain direct or indirect entity references to external entities.

Well Formedness Constraint: No < in Attribute Values

No < in Attribute Values

The Replacement Text of any entity referred to directly or indirectly in an attribute value MUST NOT contain a <.

An example of a start-tag:

<termdef id="dt-dog" term="dog">

The end of every element that begins with a start-tag MUST be marked by an end-tag containing a name that echoes the element's type as given in the start-tag:

End-tag
3.1    ETag   ::=   '</' Name S? '>'

An example of an end-tag:

</termdef>

The Text between the start-tag and end-tag is called the element's content:

Content of Elements
3.1    content   ::=   CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*

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. An empty-element tag takes a special form:

Tags for Empty Elements
3.1    EmptyElemTag   ::=   '<' Name (S Attribute)* S? '/>'

Empty-element tags MAY be used for any element which has no content, whether or not it is declared using the keyword EMPTY. For interoperability, the empty-element tag SHOULD be used, and SHOULD only be used, for elements which are declared EMPTY.

Examples of empty elements:

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