Intro to XML
Please turn off all
Outline
Part I: XML Basics
What is XML?
Extensible Markup Language
XML is a Meta Markup Language
XML Applications
Some XML Applications
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
CSS or XSL?
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
Questions?
What is XML used for?
Domain-Specific Markup Languages
Self-Describing Data
An XML Fragment
Interchange of Data Among Applications
Example XML Applications
Mathematical Markup Language
Channel Definition Format
Classic Literature
Vector Graphics
The Resource Description Framework (RDF)
An Example of RDF
File Formats, in-house applications, and other behind the scenes uses
XML for XML
XSL: The Extensible Stylesheet Language
An XML document
An XSLT style sheet that converts to XSL-FO
The XSL-FO Output
W3C XML Schemas
XML Hypertext
XML Hypertext Example
XLinks: The Extensible Linking Language
Extended Links
Extended Link Example
Diagram of an Extended Link
XInclude
Non-XML for XML
XPath
XPointers
XPointers and URIs
Questions?
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
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?
Questions?
Part II: Well-formedness, DTDs, and Validity
Well-formedness vs validity
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
Character References
Questions?
XML is a Meta Markup Language
A Song Description in XML
A DTD for Songs
A Valid Song Document
Validity
Checking Validity
Internal DTDs
What is XML used for?
Domain-Specific Markup Languages
Self-Describing Data
Interchange of Data Among Applications
Structured and Integrated Data
XML Applications
DTDs and Validity
What is a DTD?
The importance of validation
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
Grouping With Parentheses
Mixed Content
Empty elements
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
ENTITY
ENTITIES
NOTATION
NMTOKEN
NMTOKENS
Enumerated
General Entity References
General Entity Reference Example
External General Entity References
A DTD that declares External General Entities
An External Parsed General Entity
A Document that uses External General Entity References
Parameter Entity References
External Parameter Entity References
The description element
XHTML
External Parameter Entity References
Finished DTD
Internal DTD Subsets
Schemas
Questions?
Part III: 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
Binding namespaces to prefixes with #FIXED ATTLIST declarations
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
Binding default namespaces to elements with #FIXED ATTLISTs
How Parsers Handle Namespaces
Namespaces and DTDs
Part IV: XSL, the Extensible Stylesheet Language
What Is XSL?
Versions
The Process of an XSL Transformation
An Example XML Document
An XSLT Style Sheet
Output
Templates
The actual HTML output
Adding the root
The actual HTML output
Applying Templates
The actual HTML output
The select attribute
The actual HTML output
Expanding the coverage
The actual HTML output
Attributes
The actual HTML output
Attribute Value Templates
The actual HTML output
xsl:copy
The generated HTML
The Or Operator in Match Patterns
The * wildcard
The node() and @* wildcards
Are we being too greedy?
Testing conditions with xsl:if
The actual HTML output
Matching composers with compositions
Matching composers with compositions
The actual HTML output
Sorting with xsl:sort
The actual HTML output
Multiple Key Sorts
The actual HTML output
Sorting by Composition Title
The actual HTML output
xsl:for-each
The actual HTML output
Sorting the Table of Contents
Adding Links from the Table of Contents
The actual HTML output
Numbering Output
String functions
substring()
The actual HTML output
Number Operators
Number Functions
Where Does the Transformation Happen?
Client Side Processing
A style sheet that works with Internet Explorer 5.0 and 5.5
What else does XSLT have?
What does XSLT not have?
Summary
To Learn More
Questions?
Part V: Programming with XML
Several APIs to choose from
SAX
SAX2
The SAX Process
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
XML and Databases
Integrating XML with Databases
Middleware
Database Exchange and Integration
To Learn More
Questions?
Entire Presentation as Single File
Start
|
Cafe con Leche
Copyright 2000, 2001 Elliotte Rusty Harold
Last Modified February 18, 2001