Contents
Overview 1
Lesson: Metadata and XML Processing 2
Lesson: XML Processing Technologies 6
Module 4: Technologies
for Handling XML Data
Information in this document, including URL and other Internet Web site references, is subject to
change without notice. Unless otherwise noted, the example companies, organizations, products,
domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious,
and no association with any real company, organization, product, domain name, e-mail address,
logo, person, places or events is intended or should be inferred. Complying with all applicable
copyright laws is the responsibility of the user. Without limiting the rights under copyright, no
part of this document may be reproduced, stored in or introduced into a retrieval system, or
transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or
otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
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.
2001 Microsoft Corporation. All rights reserved.
Microsoft, MS-DOS, Windows, Windows NT, ActiveX, BackOffice, bCentral, BizTalk,
FrontPage, MSDN, MSN, Netshow, PowerPoint, SharePoint, Visio, Visual Basic, Visual C++,
Visual C#, Visual InterDev, Visual Studio, Windows Media, and Xbox are either registered
trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their
respective owners.
Module 4: Technologies for Handling XML Data iii
Instructor Notes
After completing this module, participants will be able to:
!
Identify the appropriate technology for the task that requires them to
manipulate Extensible Markup Language (XML) data.
!
Explain the range of use for the Document Object Model (DOM), XML
Path Language (XPath), Extensible Stylesheet Language (XSL), Extensible
Stylesheet Language Transformations (XSLT), and XQuery.
Materials and Preparation
This section provides the materials and preparation tasks that you need to teach
this module.
To teach this module, you need the following materials:
• Microsoft
®
PowerPoint
®
file 2500A_04.ppt
To prepare for this module:
!
Read all of the materials for this module.
!
Read the modules on DOM, XPath, XSL and XSLT, and XQuery.
!
Be ready to compare and contrast the uses of the technologies that are
discussed in this chapter.
Presentation:
45 Minutes
Required Materials
Preparation Tasks
iv Module 4: Technologies for Handling XML Data
Module Strategy
This is an overview module. The instructional strategy depends on the quality
of your lecture. Be prepared to carefully and quickly explain the ideas presented
here. You have less than an hour to complete this module, so present each slide
without lingering on any particular topic. The modules that follow this one
discuss each issue in more depth.
Use the following strategy to present this module:
!
Metadata and XML Processing
A major source of confusion to participants is why object models are needed
to describe XML. This lesson describes situations that require some
application logic to perform a query. The lesson says that the DOM and
XPath object models create a metadata structure. Applications require
metadata to perform sophisticated operations.
Metadata is a term that is often used but not often readily understood. Be
sure that participants understand this term, because understanding metadata
is critical to appreciating the role XML plays in building data-centric
applications.
Use the idea of metadata to explain why both DOM and XPath use a tree of
nodes to represent XML data.
!
XML Processing Technologies
The profusion of XML technologies that exist can be confusing to the
newcomer. This lesson helps the participant by providing an overview of the
major technologies.
Briefly define DOM. A very simple XML fragment in the text illustrates
why you must search XML by using node properties instead of a simple text
search.
Briefly define XPath. XPath is defined here as an object model optimized
for specifying location information. Contrast the functionality of XPath with
that of DOM. Stress that XPath is central to using the other XML
technologies.
Define XQuery as a comprehensive and ambitious query technology.
Provide a basic definition of XSL. This lesson defines XSL as the
formatting language for XML. It discusses XSLT and XSL-FO as specialty
subset languages within XSL. XSL-FO is not discussed any further in the
course, because at the time of publication, it is not widely adopted. It is not
a World Wide Web Consortium (W3C) Recommendation.
Module 4: Technologies for Handling XML Data 1
Overview
!
Metadata and XML Processing
!
XML Processing Technologies
*****************************
ILLEGAL FOR NON
-
TRAINER USE
******************************
This module describes several interdependent technologies. You use them to:
!
Query an Extensible Markup Language (XML) document.
!
Change the content of an XML document.
!
Change the structure of an XML document.
This module will help you choose which technologies to apply in different
circumstances.
After completing this module, you will be able to:
!
Identify the appropriate technology for the task that requires you to
manipulate XML data.
!
Explain the range of use for the Document Object Model (DOM), XML
Path Language (XPath), Extensible Stylesheet Language (XSL), Extensible
Stylesheet Language Transformations (XSLT), and XQuery.
Introduction
Objectives
2 Module 4: Technologies for Handling XML Data
Lesson: Metadata and XML Processing
!
What Is XML Metadata?
!
How to Use XML Metadata
*****************************
ILLEGAL FOR NON
-
TRAINER USE
******************************
This lesson presents the main technologies for handling XML data.
After completing this lesson, you will be able to:
!
Define metadata, tree, and node.
!
Explain why you need metadata to process XML.
Introduction
Lesson ob
jectives
Module 4: Technologies for Handling XML Data 3
What Is XML Metadata?
!
Metadata is data about data
!
Humans use lexical metadata to understand
the markup
"
Consists of the meaning of the element and attribute
names
!
Software uses structural metadata
"
Consists of the element hierarchy and the presence of
attributes, comments, or CDATA sections
!
DOM and XPath model structural metadata as a tree
*****************************
ILLEGAL FOR NON
-
TRAINER USE
******************************
Metadata is a general computing term that means data about data.
Consider a recipe for making French bread that is written on an index card. The
data is the recipe. The metadata is the name of the person who wrote the recipe
on the index card, where the card is located, or any other information about the
recipe.
If the recipe is in a text file instead of written on an index card, then the
metadata is the recipe’s file name, the date the file was created, the size of the
file on the disk, and whether it is marked as read-only. The metadata in this case
provides the operating system with the information required to find the file, sort
the file in a list, and so on.
There are two ways of looking at metadata in XML. The names of elements and
attributes can be viewed as metadata, because most often they describe their
contents. The lexical metadata inherent in element and attribute names allows
developers to understand some of the meaning of the data by reading the
markup.
Many of the structural aspects of XML can be useful as metadata. Structural
metadata is useful for exercising programmatic control over XML. For
example, the hierarchical structure of XML can be useful for establishing the
coordinates of a piece of data located deep within a large XML hierarchy. You
can use the fact that a certain attribute only occurs in elements three levels
down from the root element.
Whether attributes, processing instructions, character data (CDATA) sections,
or comments are present or not can also be a useful form of structural metadata.
For example, you can program an application to use data encoded in XML
processing instructions, or you can put very long sections of code in CDATA
sections. Attributes can contain information about namespaces. Any of these
structural features can be used to develop a schema. Solutions built using XML
technologies rely on structural metadata in many ways to exercise
programmatic control over XML.
Introduction
Lexical XML metadata
Structural XML metadata
4 Module 4: Technologies for Handling XML Data
DOM and XPath both process XML by creating a tree representation of its
structural metadata. The structural metadata is represented as a tree of nodes.
Modeling XML data as a tree of nodes creates groups of related data that you
can use to efficiently locate, query, and change specific content.
DOM and XPath: XML
metadata as a tree