End Tag


The end tag functions exactly like a right parenthesis or a closing quotation mark or a right curly brace . It contains no data of its own; it simply ends the most recent (innermost) tag with the same name .

XML requires a matching end tag for each start tag. Not only must they have matching names , but they must also nest properly. The most recently encountered start tag must be paired with the next end tag. If they do not match, it is a fatal error.

Syntax

The end tag contains exactly the same name as the start tag it closes . Simple punctuation distinguishes it from the start tag:

XML
 </TAG> 

It cannot include attribute assignments or any other content.

Rules

Each end tag must have

  • the </ character pair

  • the name

  • the > character

Alternatively, in the special case of an empty element, the end tag may be fused with the start tag. This results in an empty tag containing

  • the < character

  • the name

  • optional attribute assignments

  • the /> character pair

Examples of End Tags
<Team> . . . </Team> Street, city, etc.
 <Team> . . . <Player> . . .     </Player> . . . </Team>- 
Proper nesting
<Play> </Play> Empty Play element
<Play/> Exactly equivalent to the preceding , using an empty tag
 <Play  speed= "normal"/> 
Empty Play element with speed attribute
 <A><B> . . . <C/> <C/><B> . . . <C></C></B></B></A> 
Complex nesting: A contains only B, which contains data, two empty Cs, and another B. This inner B also has data and a single empty C. All three Cs are equivalent.
Bad Examples
<Team> </team> Not a match (case violation)
<Team/>. . . </Team> End tag paired with self-ending empty start tag
 <Team> . . . <Player> . . .     </Team>  </Player> 
Bad nesting


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