Datasheet

Figure 1-8 shows the HTML display of the preceding HTML coded page, and the XML dis-
played document in Figure 1-7 (the previous example).
Figure 1-8: HTML embeds the code and is less flexible than XML.
Comments: Both XML and HTML use the same character strings to indicate commented
out code:
<!-- This is a comment and will not be processed by the HTML or XML parser -->
Elements
As you have already seen in the previous section, an XML element is the equivalent of an HTML tag. A
few rules apply explicitly to elements:
Element naming rules: The names of elements (XML tags) can contain all alphanumeric
characters as long as the name of the element does not begin with a number or a punctuation
character. Also, names cannot contain any spaces. XML delimits between element names and
attributes using a space character. Do not begin an element name with any combination of the
letters XML, in any combination of uppercase or lowercase characters. In other words,
XML_1,
xml_1, xML_1, and so on, are all not allowed. It will not produce an error to use multiple opera-
tive characters, such as
+ (addition) and (subtraction), but their use is inadvisable. Elements
least likely to cause any problems are those containing only letters and numbers. Stay away
from odd characters.
17
What Is XML?
04_791202 ch01.qxp 10/6/06 10:59 AM Page 17