Page 115 - Electronic Commerce
P. 115
Chapter 2
population and continent), this approach would not work at all. The Web designer could
use various combinations of text attributes such as size, font, color, bold, or italics to
90 distinguish among items, but none of these tags would convey the meaning of the
individual data elements. The only information about the meaning of each country’s
listing appears in the first list item, which includes the definitions for each element. In the
late 1990s, Web professionals began to consider XML as a list-formatting alternative to
HTML that would more effectively communicate the meaning of data.
XML differs from HTML in two important respects. First, XML is not a markup
language with defined tags. It is a framework within which individuals, companies, and
other organizations can create their own sets of tags. Second, XML tags do not specify
how text appears on a Web page; the tags convey the meaning (the semantics) of the
information included within them. To understand this distinction between appearance
and semantics, consider the list of countries example again. In XML, tags can be created
for each fact that define the meaning of the fact. Figure 2-12 shows the countries data
marked up with XML tags. Some browsers, such as Internet Explorer, can render XML
files directly without additional instructions. Figure 2-13 (on the next page) shows the
country list XML file as it would appear in an Internet Explorer browser window.
declaration
<?xml version="l.0"?>
<CountriesList>
root
element
<Country Name = "Argentina">
<CapitalCity>Buenos Aires</CapitalCity>
<AreaInSquareKilometers>2,766,890</AreaInSquareKilometers>
<OfficialLanguage>Spanish</OfficialLanguage>
<VotingAge>18</VotingAge>
</Country>
<Country Name = "Austria">
<CapitalCity>Vienna</CapitalCity>
<AreaInSquareKilometers>83,858</AreaInSquareKilometers>
<OfficialLanguage>German</OfficialLanguage>
<VotingAge>19</VotingAge>
</Country>
<Country Name = "Barbados">
<CapitalCity>Bridgetown</CapitalCity>
<AreaInSquareKilometers>430</AreaInSquareKilometers>
<OfficialLanguage>English</OfficialLanguage>
<VotingAge>18</VotingAge>
</Country>
<Country Name = "Belarus">
<CapitalCity>Minsk</CapitalCity> Learning
<AreaInSquareKilometers>207,600</AreaInSquareKilometers>
<OfficialLanguage>Byelorussian</OfficialLanguage>
<VotingAge>18</VotingAge> Cengage
</Country>
2015
</CountriesList> ©
FIGURE 2-12 Country list data marked up with XML tags
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.