Intro to XML

5/17/99


Click here to start


Table of Contents

Intro to XML

What is XML?

XML is a Meta Markup Language

XML describes structure and semantics, not formatting

A Song Description in HTML

A Song Description in XML

Style Sheets provide formatting

Attaching style sheets to documents

Templates for Other Elements

Style Sheets can be quite complex

What is XML used for?

Domain-Specific Markup Languages

Self-Describing Data

<PERSON ID="p1100" SEX="M">

Interchange of Data Among Applications

Structured and Integrated Data

XML Applications

Example XML Applications

Mathematical Markup Language

Channel Definition Format

Classic Literature

Vector Graphics

The Resource Description Framework (RDF)

An Example of RDF

XML for XML

XSL: The Extensible Stylesheet Language

DCD: The Document Content Description Schema Language

XLL: The Extensible Linking Language

File Formats, in-house applications, and other behind the scenes uses

Hello XML

The XML Declaration

The FOO element

greeting.xml

Style sheets

xml-stylesheet

greeting.css

greeting.xsl

Attaching a style sheet to an XML document

A larger example: Baseball statistics

Sample statistics

Organizing the Data

What is the Root Element

The Root Element

What are the Immediate Children of The root?

Child Elements

White space in XML is not especially significant

Leagues

Divisions

Teams

Player Data

Player Batting Statistics

What does a player look like

The Complete 1998 Major League

A Style Sheet

Cascading Style Sheets

The Default Rule

A style rule for the YEAR element

Style Rules for Division and League Names

Alternate Style Rules for Division and League Names

Style Rules for Teams

Style Rules for Players

Finished Style Sheet

Possible Extensions

Possible Solutions

Attributes

Attributes in the Baseball Example

Leagues are still child elements

Team Attributes

Team Attributes

Player Attributes

Attributes and Elements

Attributes vs. Elements

When not to use attributes

Empty Tags

The Extensible Style Language

The Two Parts of XSL

Templates

XSL Instructions

An XSL style sheet

xsl:for-each and xsl:value-of

xsl:for-each and xsl:value-of

Namespaces and XSL

Leagues

Divisions and Teams

Players

CSS or XSL?

Well-formedness Rules

Open and close all tags

Empty tags end with />

There is a unique root element

Elements may not overlap

Attribute values are quoted

< and & are only used to start tags and entities

Only the five predefined entity references are used

DTDs and Validity

What is a DTD?

The importance of validation

A DTD for greeting.xml

Document Type Declarations

Invalid Documents

Validating Tools

Element Declarations

Content Specifications

ANY

#PCDATA

#PCDATA

Child Elements

Sequences

One or More Children +

Zero or More Children *

Zero or One Children ?

Finished DTD

Choices

Grouping With Parentheses

Mixed Content

Empty elements

Attribute Declarations

Multiple Attribute Declarations

Attribute Types

CDATA

ID

IDREF

IDREFS

ENTITY

ENTITIES

NOTATION

NMTOKEN

NMTOKENS

Enumerated

Attribute Default Values

#REQUIRED

#IMPLIED

#FIXED

Internal DTDs

Internal DTD Subsets

Programming with XML

SAX, the Simple API for XML

The Document Object Model (DOM)

Additional Technologies

Namespaces

XLinks

XPointers

The Resource Description Framework

To Learn More: Books

Questions?

Author: Elliotte Rusty Harold

Email: elharo@metalab.unc.edu

Home Page: http://metalab.unc.edu/xml/

Download presentation source