Copyright © 2006 Open Geospatial Consortium. All Rights Reserved.
26
XmlDeclarationToken, BangToken, BangBracketToken, ProcessingInstrToken, StringTableToken, IndexTableToken,
TrailerToken }
8.5 Elements and
attributes
Elements and attribute definitions are split into the pieces that normally represent nodes in a tree representation of an XML document. The element and attribute definitions are modelled
after the WAP-XML representation. An element starts with one of:
EmptyElementToken
,
EmptyAttrElementToken
,
ContentElementToken
, or
ContentAttrElementToken
. The type of token identifies whether there are attributes or content present within the element.
The least-significant two bits of the code value can be used to identify whether the content andor attributes are present.
8.5.1 Empty-element token
The empty-element with no attributes token is defined as:
EmptyElementToken { element TokenType type = EmptyElementCode; token-type code
Count stringRef; symbol code for element name }
This token is equivalent to the XML empty-element markup, e.g., “
blah
” without quotations. This token is self-complete and does not need to be followed by any other
specific tokens. A symbol-string reference is used instead of a literal element name for space and processing efficiency. The string reference is an index into the global string table, where
index values start from zero. Element-name values must conform to XML constraints.
8.5.2 Empty-element-with-attributes token
The empty-element-with-attributes token is defined as:
EmptyAttrElementToken { element ... TokenType type = EmptyAttrElementCode; token-type code
Count stringRef; symbol code for element name }
This token is equivalent to the XML empty-element markup, e.g., “
blah attr=value
”. This token must be followed by a list of at least one
AttributeStartToken
plus associated content, and the attribute list must be terminated by an
AttributeListEndToken
, or, optionally, a
StringTableToken
may precede any
AttributeStartToken
, to simplify string-table handling in writers.
8.5.3 Content-element token
The content-element without attributes token is defined as:
Copyright © 2006 Open Geospatial Consortium. All Rights Reserved.
27
ContentElementToken { element TokenType type = ContentElementCode; token-type code
Count stringRef; symbol code for element name }
This token may be followed by any number of content tokens and embedded sub-elements, including zero, and must be terminated by an
ElementEndToken
.
8.5.4 Content-element-with-attributes token
The content-element-with-attributes token is defined as:
ContentAttrElementToken { element ... TokenType type = ContentAttrElementCode; token-type code
Count stringRef; symbol code for element name }
This token must be followed by a list of at least one
AttributeStartToken
plus associated content with optional
StringTableToken
prefixes, and the attribute list must be terminated by an
AttributeListEndToken
. The attribute list may be followed by any number of content tokens and embedded sub-elements, including zero, and the token
sequence must be terminated by an
ElementEndToken
.
8.5.5 Element-end token