Start Tag


XML data is a serial stream. The start tag informs the receiving software that all the incoming data will belong to this element until the matching end tag is encountered. Very often, more start tags are encountered before the end tag. Each start tag must be matched with its own end tag before the previous start tag can be matched.

Syntax

A start tag is simply an element name framed by angle brackets:

XML
 <TAG> 

If the element has attributes assigned to it, they belong within the start tag. An element can have multiple attributes, but they must be unique:

XML
 <TAG attribute="value"> 

Space is forbidden between the opening bracket and the name. It is required before each attribute assignment. It is optional before the end bracket .

Start tags should look familiar to anyone who has worked with HTML.

Rules

Each start tag must have

  • the < character

  • a name

  • the > character

Additionally, every start tag may contain:

  • Attribute assignments

  • Whitespace after the tag's name

Examples of Start Tags
<ADDRESS> Street, city, etc.
 <player   > 
Contains legal but probably useless whitespace
 <team   mascot= "wildcat"> 
Contains valid attribute assignment
 <team   mascot="wildcat" color="purple"> 
Multiple attribute assignment is permitted
Bad Examples
 <  player  > 
Illegal whitespace before name
 <team   color="purple" color="white"> 
Duplicate attribute assignment is forbidden.


Flash and XML[c] A Developer[ap]s Guide
Flash and XML[c] A Developer[ap]s Guide
ISBN: 201729202
EAN: N/A
Year: 2005
Pages: 160

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net