XML Fundamentals
XML Fundamentals
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
Editing and Saving XML Files
Style Sheets provide formatting
Attaching style sheets to documents
Style Sheet Languages
An XSLT stylesheet
Transforming the Document
Well-formedness
Validity
A DTD for Songs
A Valid Song Document
Checking Validity
A More Complex Example
The XML Declaration
Attributes
Empty Element Tags
Comments
Namespaces
Entity References
A More Complex DTD
What is XML used for?
Domain-Specific Markup Languages
Self-Describing Data
An XML Fragment
Interchange of Data Among Applications
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
W3C XML Schemas
XLinks: The Extensible Linking Language
Non-XML for XML
File Formats, in-house applications, and other behind the scenes uses
A larger XML example: Music Catalog
Sample Catalog
Organizing the Data
What is the Root Element
The Root Element
The Root Element Style Sheet
The Root Element Style Sheet Output
What are the Immediate Children of the Root?
Child Elements
Style Sheet
Style Sheet Output
White space in XML is not especially significant
Composers
Style Sheet
Style Sheet Output
Grand Children
The Same Style Sheet Still Works
Style Sheet Output
Attributes
Style Sheet with Attributes
Style Sheet Output
Attributes vs. Elements
When not to use attributes
Compositions
Composition Example in HTML
Each composition has a
Composition Example in XML
Style Rule for Compositions
Style Sheet Output
Attaching the Composer to the Composition
Arranging Compositions by Composer
Style Sheet Output
Some Keywords For the Search Engines
Standard Signature
Cascading Style Sheets
A Blank Style Sheet
The Default Rule
A style rule for the category element
A style rule for the composer element
A style rule for the title element
A style rule for the catalog info
Style rules for the signature
Style Rules for composition children
Finished Style Sheet
Possible Extensions
Possible Solutions
CSS or XSL?
Programming with XML
Several APIs to choose from
SAX
SAX2
The SAX Process
Making an XMLReader
Parsing a Document with XMLReader
The ContentHandler interface
SAX Example
Event Based API Caveats
Document Object Model
The Design of the DOM API
DOM Evolution
Eight Modules:
DOM Trees
org.w3c.dom
The DOM Process
Parsing documents with a DOM Parser Example
DOM Example
JDOM
The JDOM Process
Parsing a Document with JDOM
Parser Results
JDOM Example
Questions?
To Learn More
Entire Presentation as Single File
Start
|
Cafe con Leche
Copyright 2000
Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified September 19, 2000