Tải bản đầy đủ (.pdf) (50 trang)

Module 1: Overview of XML Documents

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.06 MB, 50 trang )








Contents
Overview 1
Structuring Data 2
What is XML? 10
Creating XML Documents 19
Grammars and Namespaces 36
Demonstration: The LitWare Books
Application 42
Review 43

Module 1: Overview of
XML Documents


Information in this document is subject to change without notice. The names of companies,
products, people, characters, and/or data mentioned herein are fictitious and are in no way intended
to represent any real individual, company, product, or event, unless otherwise noted. Complying
with all applicable copyright laws is the responsibility of the user. No part of this document may
be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of Microsoft Corporation. If, however, your only
means of access is electronic, permission to print one copy is hereby granted.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual
property rights covering subject matter in this document. Except as expressly provided in any


written license agreement from Microsoft, the furnishing of this document does not give you any
license to these patents, trademarks, copyrights, or other intellectual property.

 2000 Microsoft Corporation. All rights reserved.

Microsoft, PowerPoint, Visual Interdev, and Windows are either registered trademarks or
trademarks of Microsoft Corporation in the U.S.A. and/or other countries.

The names of companies, products, people, characters, and/or data mentioned herein are fictitious
and are in no way intended to represent any real individual, company, product, or event, unless
otherwise noted.

Other product and company names mentioned herein may be the trademarks of their respective
owners.


Program Manager: Steve Merrill
Instructional Designers: Sangeeta Nair (NIIT), Vijayalakshmi Narayanaswamy (NIIT)
Subject Matter Experts: Andy Olsen (QA Training), Andy Longshaw (Content Masters)
Content Lead: Janet Robinson
Graphic Artist: Scott Serna (Creative Assets)
Media Management: David Mahlmann
Media Production: Dean Connolly (Art Source), Timothy Demmon (:timebomb Media)
Editing Manager: Jennifer Linn
Editor: Dennis Rae (Wasser)
Production Manager: Miracle Davis
Print Coordinator: Marlene Lambert (Online Training Solutions, Inc)
Build Manager: Julie Challenger
Build Coordinator: Jenny Boe
Test Lead: Eric Myers

Manufacturing Manager: John Williams
Group Product Manager: Steve Elston

Module 1: Overview of XML Documents iii


Instructor Notes
This module provides students with an introduction to XML. The module
describes some of the problems currently facing organizations that need to store
data and interchange it between applications, and then shows the syntax for an
XML document.
By the end of this module, students should appreciate the problems that XML
solves, and be comfortable with the syntax for elements, attributes, and
namespaces in a static XML document. Students should also be aware of the
standardization process overseen by the World Wide Web Consortium (W3C),
and be made aware of Microsoft’s position with regard to these standards.
After completing this module, students will be able to:
!
List the uses for XML on a Web site.
!
List advantages and disadvantages of using XML.
!
Describe the structure of an XML document.
!
Create a simple XML document.
!
List some of the issues associated with designing XML documents.

Materials and Preparation
This section provides you with the required materials and preparation tasks that

you need to teach this module.
Required Materials
To teach this module, you need the following materials:
!
Microsoft PowerPoint
®
file 1905a_01.ppt
!
Module 1, “Overview of XML Documents”

Preparation Tasks
To prepare for this module, you should:
!
Read all of the materials for this module.
!
Study the LitWare Books lab solution. Students complete this lab during the
course. The lab solution is introduced in this module to set the scene for the
rest of the course.
!
Visit the W3C Web site at and the OASIS Web site at
/> to familiarize yourself with the layout and
scope of these Web sites.
!
Visit Microsoft’s XML Web site at to
familiarize yourself with its layout and scope.

Presentation:
120 Minutes

Lab:

00 Minutes
iv Module 1: Overview of XML Documents


Demonstration
This section provides demonstration procedures that will not fit in the margin
notes or are not appropriate for the student notes.
Demonstration: Creating and viewing an XML document
!
To run this demonstration
1. In Notepad, open the file Employees.xml from the folder
\InetPub\WWWRoot\1905\DemoCode\Mod01.
Describe the syntax of the document.
2. Launch Microsoft Internet Explorer 5 and open Employees.xml. Show that
you can collapse and expand the nodes of the tree in Internet Explorer 5.
3. Make some errors in Employees.xml, such as changing the capitalization of
an element or deleting a closing tag, and redisplay the file in Internet
Explorer 5 to show how the browser handles documents that are not well
formed.
4. In Internet Explorer 5, open the file Macbeth.xml from the folder
\InetPub\WWWRoot\1905\DemoCode\Mod01.
5. Describe the elements in the document and explain why XML is well suited
for representing structured data such as the entire contents of Shakespeare’s
play Macbeth. For example, with the data in XML, you could easily add
lighting instructions for a stage performance of the play.
6. In Internet Explorer 5, open the file WeatherReport.xml from the folder
\InetPub\WWWRoot\1905\DemoCode\Mod01 and point out that the
document uses a mixture of elements and attributes.
Do not talk about the design issues around using attributes or child elements
just yet.


Demonstration: The LitWare Books application
In this demonstration, describe the functionality of the LitWare Books
application and the technologies that are used for each step.
!
To run this demonstration
1. Launch Internet Explorer 5 and enter the URL for the LitWare Books
solution Web site, http://localhost/LitwareSolution.
In this application, the user looks for books, places selected books into a
client-side XML shopping basket, and then posts the XML to the server to
order the books.
2. On the home page, enter Lars% in the query by author field, and then
click Query.
QueryInput.htm posts a query to the ASP page Query.asp, which executes
an ADO query and returns matching books as XML, with an attached XSL
style sheet, QueryResult.xsl.
Module 1: Overview of XML Documents v


3. Click one of the Details links.
The link passes ISBN information to the ASP page Details.asp. The server
executes another ADO query and returns an HTML document containing an
XML data island with the book details. The HTML document uses data
binding to display the information.
4. Enter a number in the quantity text field, and then click Add to Basket.
Details.asp uses client-side DOM script to transform the book information,
using TransformBookDetails.xsl, into a format expected by the server, and
then adds the transformed data to a client-side XML data island stored in
default.htm.
5. Click View Order.

ViewOrder.htm uses client-side DOM script to traverse the client-side data
island and build an HTML string describing the shopping basket contents.
6. Click Go to Checkout. Enter customer number 1, and then click Submit
Order.
Checkout.htm posts the XML shopping basket data to the ASP page
CustomerOrder.asp. The server validates the data with the schema
CustomerOrderSchema.xml, enters the order information into the database,
and then returns a confirmation message to the client.

Other Activities
This section provides procedures for implementing interactive activities to
present or review information, such as games or role-playing exercises.
Practice: Creating an XML document
Have students work on their own to create a well-formed XML document
describing an airline ticket. Then display a couple of different documents and
talk about the different elements and attributes used in each.
The following is one solution to the practice exercise:
<?xml version="1.0"?>
<ticket>
<passenger>
<name>Sue Jackson</name>
</passenger>
<leg>
<flight carrier="Blue Yonder Airways" number="123" />
<frequent_flyer>112890FN</frequent_flyer>
<meal type="vegetarian" />
<departure date="2/1/00" time="1:00pm">
<airport>SEATAC</airport>
</departure>
<arrival date="2/1/00" time="3:00pm">

<airport>LAX</airport>
</arrival>
</leg>
</ticket>


vi Module 1: Overview of XML Documents


Module Strategy
Use the following strategies to present this module:
!
Structuring Data
The purpose of this section is to present a backdrop for XML. Describe the
problems currently facing information processing so that students appreciate
the need for XML. The key point to stress is that data is meaningless unless
you know the context of the data, and XML offers a way of providing that
context.
!
What is XML?
In this section, you will introduce how XML is used on the Web and
compare it with HTML. Most students will have seen some HTML before,
so you can simply emphasize the differences between XML and HTML
syntax. Make sure that students realize the different purposes of XML and
HTML — HTML defines how to present data, but XML defines the meaning
of the data. XML is not replacing HTML.
Discuss the benefits to the server in delivering XML rather than HTML. The
server can send the same XML file to any browser, rather than generating a
different version of HTML for each browser.
Also discuss the benefits to the browser in retrieving XML. The client can

perform local filtering, reordering, changing display formats, and so on
without involving the server.
!
Creating XML Documents
This section introduces the basic syntax for XML elements and attributes
and the difference between a well-formed and a valid XML document.
Discuss the overall format of an XML document. Emphasize the XML
declaration and the fact that a document can only have a single root element.
Do not go into too much detail on DTDs yet — they are discussed in Module
2: Overview of XML Technologies.
Don’t go into too much detail about Microsoft’s toolset for XML. Many of
these tools are covered later in the course.
In the practice, students are asked to design their own XML documents.
After completion, compare various solutions to see how different they are.
Finally, describe some of the reasons for choosing between elements and
attributes in an XML document. Don’t allow students to get too bogged
down in this discussion, as there are no tried and true guidelines available
yet.
!
Grammars and Namespaces
Discuss the benefits of having “standard” grammars for particular business
sectors. For some examples, you can visit />
and navigate to the XML Applications page, where a large number of
existing grammars are described.
Ask students what problems might arise if two companies decide to define
their own grammars. For example, there is the possibility of name clashes.
Describe namespaces as a way of resolving these clashes. Discuss qualified
namespaces first (that is, with a namespace prefix), then discuss default
namespaces (that is, no namespace prefix).


Module 1: Overview of XML Documents 1


#
##
#

Overview
!
Structuring Data
!
What is XML?
!
Creating XML Documents
!
Grammars and Namespaces
!
Demonstration: The LitWare Books Application
!
Review


This module provides an overview of the Extensible Markup Language, or
XML. You will learn about the need for XML documents in e-commerce and
Information Technology, and see how to create a simple XML document
containing a few basic elements and attributes.
XML is an evolving standard governed by the Worldwide Web Consortium
(W3C). This module describes the current state of the technology and highlights
some of the industry initiatives that are helping to take XML forward into the
future.

After completing this module, you will be able to:
!
List the uses for XML on a Web site.
!
List advantages and disadvantages of using XML.
!
Describe the structure of an XML document.
!
Create a simple XML document.
!
List some of the issues associated with designing XML documents.

Slide Objective
To provide an overview of
the module topics and
objectives.
Lead-in
This module introduces the
need for XML in e-
commerce, and shows how
to create simple XML
documents. The module
also looks at some of the
available tools and
discusses current trends in
the XML community.
Delivery Tip
There are no labs in this
module, only practices.
2 Module 1: Overview of XML Documents



#
##
#

Structuring Data
!
Structured vs. Unstructured Data
!
Problems with Information Processing
!
Searching Data
!
The Need for XML
!
Describing Data with XML Tags


The growth and power of the Web lies in its ability to let us communicate with
anyone, anywhere. This became possible only through standard technologies
such as Internet Protocol (IP), Hypertext Transport Protocol (HTTP), and
Hypertext Markup Language (HTML), all of which are platform-independent.
However, today we use the Web primarily as a medium to access and display
information in the form of text and graphics. The Internet must expand its role
to link applications across the entire Web in such a way that any application
anywhere can communicate with any other application or set of data. This is the
key to making the Web the backbone for business-to-business and organization-
to-organization communication.
For example, the Internet should allow the exchange of electronic payment

information, or of patient medical data and prescriptions between doctors and
pharmacists.
Today, HTML is widely used as the vehicle for exchanging information on the
Web. There is no doubt that HTML is very good as a presentation language, but
it is not suitable for representing data. For example, you can easily format data
in an HTML table, but you cannot describe the individual components of the
information. To share information between applications, you must have a
language that can describe data in a standard way so that any application,
present or future, can understand and use this data correctly.
In this section, you will learn about the problems inherent in handling
unstructured data, and how XML helps you structure your data.
Slide Objective
To provide an overview of
the topics in this section.
Lead-in
This section explains the
problems inherent in
exchanging information
between different Web
applications, and how XML
overcomes these problems.
Module 1: Overview of XML Documents 3


Structured vs. Unstructured Data
!
Data without context is meaningless and open
to misinterpretation
!
Structured data allows other applications to understand

and use the data
!
Data that describes data is known as metadata
4.00
????????


Data is useful only if its context is understood. For example, if the price of an
item is “4,” this data is useless unless one knows that the price is expressed in
dollars or some other currency.
Typically, application programs that manipulate data contain business rules that
define the context of the data. However, when data is exchanged between
applications, there is always the threat of its being misinterpreted.
Such problems can be handled to a certain extent within an organization
through the use of data dictionaries and other standards. However, with the
advent of the Internet, there is a growing need for information to be shared
electronically between organizations.
To facilitate an open exchange of data, you must first define the structure of the
data in detail and then expose it to other applications. The term “metadata”
means data about data. Metadata provides a context for data that is shared
between applications, thus enabling these applications to interpret the data
meaningfully.
Slide Objective
To explain the need for
structured data.
Lead-in
Much of the information we
use every day makes sense
only because we know the
context of its usage.

4 Module 1: Overview of XML Documents


Problems with Information Processing
!
Creating and distributing valuable
document information
!
Generating multiple output formats
!
Integrating multiple sources of information
!
Managing conditional information


When it comes to processing and delivering information, most organizations
and businesses typically face the following problems:
!
Creating and distributing valuable document information
Organizations that distribute information of great value include publishers
of technical, medical, legal, or business data, and manufacturers of complex
products whose operating and service manuals are vital companions to the
products themselves.
These organizations invest heavily in the creation and distribution of
information that their customers consider crucial. As a result, the
organizations gain maximum benefit from methods that increase the
accuracy, timeliness, and flexibility of their information while reducing
production and maintenance costs.
!
Generating multiple output formats

There is a growing need for a format-independent method of generating
multiple outputs such as printed documentation, update bulletins, CD-ROM
distribution, online (Internet) delivery, on-demand printing, Help files, and
machine-readable data.
!
Integrating information from multiple sources
When information must be collected from multiple sources, the effort
invested in integrating this information is substantially reduced if all sources
use a common formatting method agreed upon within a common-interest
community, rather than multiple varied formats.
!
Managing conditional information
If the information in a document varies depending on external factors, such
as service instructions that vary according to the weather, we need a way of
identifying the information that is dependent on these external factors. There
must be a means of managing this conditional operation so that the
appropriate document contents are produced in all circumstances.
Slide Objective
To explain the problems
faced in processing
information.
Lead-in
Organizations and
businesses face many
challenges in dealing with
information.
Delivery Tip
Separates content of data
from display of data.
Module 1: Overview of XML Documents 5



Searching Data
!
Search engines often yield irrelevant results
!
HTML-based search engines (AltaVista, Lycos)
$
Good for keyword search
$
Not appropriate for context-based search
!
Need for more intelligent search engines
$
Intelligence-based searches
$
Meaning-based searches
$
Context-based searches


Anyone who has carried out an Internet search knows that currently available
search engines often yield irrelevant results. For example, if you search the
Web today for all hotels in the city of Bath, you may get a list of all hotels that
have bathrooms (presumably quite a long list) while missing hotels that are near
the city but not actually in it.
Worse still, such a search will turn up all kinds of other documents containing
those two words, such as press releases from Bath-based companies holding
meetings in hotels. Unsatisfying results like these are not necessarily caused by
a bad search query or algorithm, but are more likely due to the limitations of

HTML-based search engines.
Popular HTML-based search engines such as AltaVista and Lycos rely on
keyword or even content searches to isolate information, because all they have
to work with is the HTML. However, when it comes to context-based searches,
these search engines can be way off-target. This is because HTML is simply a
presentation language: Its function is not to describe the content of a page, but
how that content will be displayed.
What is needed is a language that provides a means of describing data in a more
meaningful and contextual manner so that searches can be one of the following:
!
Intelligence-based
!
Meaning-based
!
Context-based

Slide Objective
To detail the problems
associated with HTML-
based search engines.
Lead-in
What quality of results have
you experienced when using
standard Internet search
engines?
6 Module 1: Overview of XML Documents


The Need for XML
!

Businesses need a way of organizing data that meets
these requirements:
$
Machine-readable and human-readable data
$
Defines the data content and structure
$
Emphasizes relationships
$
Separates structure from presentation
$
Open and extensible
!
XML fulfils these requirements


Businesses today face many problems when it comes to organizing data. They
need to meet the following requirements:
!
Data needs to be readable by both computers and users.
!
Both the content and the structure of the data need to be defined.
!
The relationship between data needs to be emphasized.
!
The structure of the data needs to be separate from the presentation of the
data.
!
The structure needs to be open and extensible.


XML fulfills all of these requirements.
XML defines the structure of data in an open and self-describing manner. This
allows data to be easily transferred over a network and consistently processed
by the receiver. Because XML is used to describe information as well as to
structure it, you can think of XML as a data-description language. You can use
XML to describe data components, records, and other data structures, for
example, complex data structures such as purchase orders.
XML is considered a markup language because it allows you to define data
structure by using markup tags. You can define your own tags that describe the
data in whatever way you find useful. This is unlike HTML, where the tags
describe how the data should be presented rather than what the data is. XML
gives you complete control over the document structure, and the presence of
tags makes it easier for other applications to ascertain the meaning of the data
and process it accordingly.
Slide Objective
To state the need for XML.
Lead-in
Let’s summarize the need
for XML before we learn
how to create XML
documents.
Module 1: Overview of XML Documents 7


XML data is held in a simple, open format that is easily parsed by other
applications. The fact that XML documents contain text rather than binary data
is another key advantage. Applications can parse an XML document, looking
for specific tags of interest to those applications. Unknown tags and their
associated data can be freely ignored.
To summarize, XML can be described as a framework for producing text

documents, with embedded tags to define the structure of the data. XML is
extensible because the set of tags supported in XML is open-ended.
8 Module 1: Overview of XML Documents


Describing Data with XML Tags
!
Documents consist of three components
Structure PresentationData
!
XML documents retain structural information about
the document contents
!
XML documents do not define presentation format


One of the reasons why XML has emerged so quickly as an exciting new
technology is that it recognizes that documents are made up of three distinct
components:
!
Data
For example, a word-processor document contains text, punctuation, and
white space.
!
Structure
For example, word-processor documents have a different structure than
spreadsheets, which in turn have a different structure than presentation files.
The structure of a document defines the document type, the organization of
its elements, and the allowed types and ordering of elements within the
document.

!
Presentation
How is the information presented to the user? What fonts are used? What
colors are required for the foreground and the background?

The XML approach is to keep these three document components separate from
each other, in contrast to the way documents traditionally have been handled.
Consider a word-processor document as an example:
!
A word-processor document combines data content (words) with
presentation information (fonts) in an almost inseparable manner. When you
create a word-processor document, you usually have a particular output
medium in mind. For example, you might adjust your table sizes and
margins so that the document looks attractive on Letter-size paper. But what
happens if you need to print the document on A4-size paper?
Slide Objective
To describe how XML tags
can be used to add meaning
to data in a document.
Lead-in
XML documents help retain
the real meaning of data.
Delivery Tip
This slide is animated so
that it shows each part of
the illustration in stages.
The slide initially shows only
the first bullet point.
Click the numbers to reveal
the following parts of the

illustration:
1. The “Data” picture
2. The “Structure” picture
3. The “Presentation” picture
4. The second bullet point,
“XML documents retain the
structural...”
5. The third bullet point,
“XML documents do not
define presentation...”
Module 1: Overview of XML Documents 9


!
A word-processor document contains very little information about the
structural content of a document. It would be difficult to write an application
to automatically interpret the content of a document and extract semantic
meaning from it.

The XML approach considers the inherent structure of a document to be as
important as the content itself. Presentation information is kept separate from
the content and structural information.
10 Module 1: Overview of XML Documents


#
##
#

What is XML?

!
History of XML and W3C
!
XML and the Web
!
XML vs. HTML
!
Advantages and Disadvantages of XML
!
Uses of XML


In this section, you will learn about the background of XML, and how XML
documents retain the true meaning of data. A comparison is drawn with HTML,
which defines how data is presented but does not describe the meaning of that
data.
Slide Objective
To provide an overview of
the topics in this section.
Lead-in
This section introduces the
syntax for XML documents,
and compares XML with
HTML documents.
Module 1: Overview of XML Documents 11


History of XML and W3C
!
XML is a simplified subset of SGML

$
Standard Generalized Markup Language
$
ISO standard defined in 1986
!
The XML standards are governed by the World Wide
Web Consortium (W3C)
$



XML is based on the Standard Generalized Markup Language (SGML), which
was defined in 1986 by the International Standards Organization (ISO) as
standard ISO 8879. SGML has been used since then across a wide range of
industry sectors and in many different formats, one of which is HTML.
The objectives of those who designed SGML were simple: Confronted with an
increasing number of so-called “markup languages” for electronic texts, each
more or less bound to a particular kind of processing or even to a particular
software package, they sought to define a single language in which all such
schemes could be re-expressed so that the essential information represented by
such texts could be transferred from one program or application to another.
The intention is to allow the clear indication of parts of a document (for
instance, subheadings) in such a way that they can be processed automatically,
for example, for checking that two subheadings of the same rank do not occur
consecutively without intervening subsection body text, or for the creation of
tables of contents. Further applications might include the annotation of a
document to enable statistical analysis of names, dates, or other elements.
SGML is a very powerful standard for markup languages, but is rather complex
to use. Its complexity has prevented it from being used as widely as one might
hope. XML is a subset of SGML. XML simplifies SGML significantly,

retaining its good points but making it easier to learn and use by the wider
developer community.
XML is in the process of standardization by the World Wide Web Consortium
(W3C). W3C is a vendor consortium responsible for inviting, creating, setting,
and broadcasting standards for use on the World Wide Web and elsewhere.
For more information about the XML standard, see
and

.
Slide Objective
To describe the origins of
XML.
Lead-in
XML is a simplification of
SGML.
12 Module 1: Overview of XML Documents


XML and the Web
!
XML can be used for HTTP transactions
!
Benefits of generating XML at the Web server
$
Generate same XML for all browsers
$
Browser does its own formatting
!
Benefits of receiving XML at the browser
$

Browser can use the data intelligently
$
Reduces network traffic and server load


XML can be used to define a standard data format for HTTP-based transactions
between Web browsers and Web servers. XML can also lighten the load on
Web servers.
The traditional Web model makes servers work very hard to communicate
streams full of HTML back to the client browser. This load on the server
inevitably degrades performance, and consequently the browser spends much of
its time waiting for the Web server to do its work and return the HTML.
One solution to this problem might be to use a bigger server, but this solution
addresses only the symptom of the problem, not the cause. XML can be used to
address the real issue by lightening the load on the server in the first place.
!
The Web server delivers XML documents rather than raw HTML to the
browser. The server can send the same XML document to all browsers,
because the data is the same in each case. This is in contrast to the situation
when HTML is returned; in this situation, the server must ascertain what
type of browser is involved and then generate a suitable stream of HTML
for that type of browser.
!
The Web server can attach a style sheet to the XML data in order to
transform the XML document into an appropriate format of HTML when it
is received at the browser. This transformation occurs at the browser, so it
does not impose any run-time overhead on the server.

In addition to XML lightening the load on the server, there are also benefits to
be found at the browser if it receives XML data. The browser can manipulate

XML data in an intelligent manner, because XML data contains meaningful
tags that can be accessed and manipulated in client-side script.
This reduces the number of times the browser has to communicate with the
server in order to process data or retrieve a different view of the data. Much of
this work can now be achieved by using client-side script.
Slide Objective
To describe the benefits of
using XML in a Web-based
application.
Lead-in
XML is a natural choice for
exchanging information
between a Web server and
a Web browser.
Module 1: Overview of XML Documents 13


XML vs. HTML
!
HTML only
describes
how to display
data
!
XML defines the
meaning of data
<employee>
<name>Jake</name>
<salary>25000</salary>
<region>Ohio</region>

</employee>
<employee>
<name>Jake</name>
<salary>25000</salary>
<region>Ohio</region>
</employee>
<TABLE>
<TR>
<TD>Name</TD><TD>Jake</TD>
</TR>
<TR>
<TD>Salary</TD><TD>25000</TD>
</TR>
<TR>
<TD>Region</TD><TD>Ohio</TD>
</TR>
</TABLE>
<TABLE>
<TR>
<TD>Name</TD><TD>Jake</TD>
</TR>
<TR>
<TD>Salary</TD><TD>25000</TD>
</TR>
<TR>
<TD>Region</TD><TD>Ohio</TD>
</TR>
</TABLE>



XML can be seen as a generalization of HTML. However, XML does not
infringe on HTML territory because XML and HTML have different objectives.
XML is a framework that allows you to define your own markup language,
whereas HTML is an example of a specific markup language.
XML describes data. In this respect, XML is very different from HTML.
!
HTML documents contain tags that provide the browser with information
on how the data should be displayed. The set of tags allowed in an HTML
document is well defined, and is fixed. You cannot define new types of
elements in HTML.
For example, the following HTML displays data in a two-column table.
However, it does not dictate the type of data in the table.
<TABLE>
<TR>
<TD>Name</TD><TD>Jake</TD>
</TR>
<TR>
<TD>Salary</TD><TD>25000</TD>
</TR>
<TR>
<TD>Region</TD><TD>Ohio</TD>
</TR>
</TABLE>
!
XML describes how data is structured, not how it should be displayed or
used. XML documents contain tags that assign meaning to the content of the
document. These tags allow programmers to find the data they need in the
XML document.
Slide Objective
To introduce the similarities

and differences between
XML and HTML.
Lead-in
Superficially, XML looks
very similar to HTML.
However, XML has a very
different purpose than
HTML.
14 Module 1: Overview of XML Documents


For example, the following XML contains information about an employee
but does not dictate how to display the data:
<employee>
<name>Jake</name>
<salary>25000</salary>
<region>Ohio</region>
</employee>

×