XML Basics


Click here to start

Table of Contents

XML Basics

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

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


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


Style sheets



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




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

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




Child Elements


One or More Children +

Zero or More Children *

Zero or One Children ?

Finished DTD


Grouping With Parentheses

Mixed Content

Empty elements

Internal DTDs

Internal DTD Subsets

Programming with XML

SAX, the Simple API for XML

The Document Object Model (DOM)

To Learn More: Books


Author: Elliotte Rusty Harold

Email: elharo@metalab.unc.edu

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

Download presentation source