XML Fundamentals
Please turn off all
Outline
Part I: XML Overview
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
The XML Declaration
Elements
Cascading Style Sheets
CSS Stylesheet for Songs
Attaching style sheets to documents
song.xsl
Applying an XSLT Style Sheet
Output
Editing and Saving XML Documents
Questions?
Well-formedness
Validity
A DTD for Songs
A Valid Song Document
Checking Validity
A More Complex Example
Attributes
Empty-element Tags
Comments
Namespaces
Entity References
A More Complex DTD
Questions?
Part II: What is XML Good For?
What is XML used for?
Domain-Specific Markup Languages
Self-Describing Data
An XML Fragment
Interchange of Data Among Applications
Can assemble data from multiple sources
XML Applications
Example XML Applications
Mathematical Markup Language
Channel Definition Format
Classic Literature
Vector Graphics
XML for XML
XSL: The Extensible Stylesheet Language
Schemas
W3C XML Schema Language Example
XLinks
File Formats, in-house applications, and other behind the scenes uses
Questions?
Part III: A Practical Example
A larger example: Music Catalog
Sample Catalog
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
Composers
Grand Children
Attributes
Attributes vs. Elements
When not to use attributes
Compositions
Each composition has a
Composition Example in XML
Further Divisions
Attaching the Composer to the Composition
Some Keywords For the Search Engines
Standard Signature
CSS Style Sheet for the Catalog
Possible Extensions
Possible Solutions
CSS or XSL?
Questions?
Part IV: Well-formedness
Well-formedness Rules
Open and close all tags
Empty-element 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
Character References
Questions?
Part V: DTDs
Well-formedness vs. validity
DTDs and Validity
What is a DTD?
Validity
A Valid Song Document
Checking Validity
Internal DTD Subsets
The importance of validation
Where are DTDs Important?
Domain-Specific Markup Languages
Self-Describing Data
Interchange of Data Among Applications
Structured and Integrated Data
An Example Document
Element Declarations
Content Specifications
ANY
#PCDATA
#PCDATA
#PCDATA
Comments in DTDs
Child Elements
Child Elements
Sequences
More Sequences
One or More Children +
Zero or More Children *
Zero or One Children ?
Choices
Mixed Content
Content Models You Can't Declare
Attribute Declarations
Multiple Attribute Declarations
Attribute Default Values
#REQUIRED
#IMPLIED
#FIXED
Attribute Types
CDATA
ID
IDREF
IDREFS
Finished DTD
Questions?
Part VI: Namespaces
Raison d'etre
The Need for Namespaces
Namespaces disambiguate elements
Namespace Syntax
Namespace URIs
Binding Prefixes to Namespace URIs
Binding Prefixes to Namespace URIs Example
Unprefixed attributes are never in any namespace
URIs matter; not prefixes
Namespace URIs do not necessarily point to a document, page, or schema
The Default Namespace
Namespaces and DTDs
Questions?
To Learn More
Questions?
Entire Presentation as Single File
Start
|
Cafe con Leche
Copyright 2002-2004 Elliotte Rusty Harold
Last Modified February 17, 2004