Section 20.2.  Tag vs. element

Prev don't be afraid of buying books Next

20.2. Tag vs. element

Tags aren't the same thing as elements. Tags describe elements and delimit them.

In Figure 20-1 the pet carrier, metaphorically speaking, is an element. The contents of the carrier is the content of an element. It is bounded by two tags.

Figure 20-1. Tags aren't elements!




The start-tag, at the left, describes the element. It contains three names:

  • The element-type name (dog), which says what type of element it is.

  • A unique identifier, or id (Spike), which says which particular element it is.

  • The name of an attribute that describes some other property of the element: weight="8 lbs".

The end-tag, at the right, marks the end of the element. It repeats the element-type name.

When people talk about a tag name:

  1. They are referring to the element-type name (in this case, dog).

  2. They are making an error, because tags aren't named.

And when they talk about an element name:

  1. They are again referring to the element-type name.

  2. They are again making an error, because an element is named by its unique identifier (in this case, Spike).

Amazon


XML in Office 2003. Information Sharing with Desktop XML
XML in Office 2003: Information Sharing with Desktop XML
ISBN: 013142193X
EAN: 2147483647
Year: 2003
Pages: 176

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