Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Table of Contents
Copyright
Foreword
Preface
What's Inside
Style Conventions
Examples
Comments and Questions
Acknowledgments
Chapter 1. Introduction
1.1 What Is XML?
1.1.1 An Information Container
Example 1-1. An XML document
Example 1-2. A MathML document
Example 1-3. An SVG document
1.1.2 A Markup Language Toolkit
1.1.2.1 Well-formedness
1.1.2.2 Validity
1.1.2.3 Document type definitions (DTDs)
1.1.2.4 Schemas
1.1.3 An Open Standard
The W3C and the Standards Process
1.1.4 A Constellation of Standards
1.2 Where Did XML Come From?
1.2.1 History
1.2.2 The Goals of XML
1.3 What Can I Do with XML?
1.3.1 Store and Retrieve Data
Example 1-4. Calendar data file
1.3.2 Format Documents
1.3.2.1 CSS
Example 1-5. A CSS stylesheet
Figure 1-1. Screenshot of a CSS-formatted document
1.3.2.2 Transformation to presentational formats
Figure 1-2. The transformation process
Example 1-6. An XSLT script for telegram documents
Figure 1-3. Transformation result
1.3.2.3 Transformation and formatting objects
Figure 1-4. How XSL works
1.3.2.4 Programming solutions
1.3.3 Ensure Data Integrity
Example 1-7. A telegram DTD
Example 1-8. A schema for telegrams
1.3.4 Support Multiple Languages
1.4 How Do I Get Started?
1.4.1 Authoring Documents
Figure 1-5. Highlighted markup in xemacs with psgml
Figure 1-6. Morphon Technologies' XMLEditor
Figure 1-7. Epic Editor from Arbortext
Table 1-1. Comparison of XML editor features
1.4.2 Viewing Documents
Figure 1-8. Internet Explorer's XML outline view
Example 1-9. A document composed of XHTML, SVG, and MathML
Figure 1-9. Amaya showing a document with XHTML, SVG, and MathML
1.4.3 Parsing
Figure 1-10. XML parsing
Example 1-10. A document that is not well-formed XML
Figure 1-11. Browser showing XML syntax error
Example 1-11. A validating parser in Perl
1.4.4 Transformation
1.4.5 Formatting for Print
Example 1-12. An XSLT stylesheet for telegram bound for FO
Figure 1-12. A PDF document generated by FOP
1.4.6 Programming
Figure 1-13. SAX makes programs modular and interchangeable
Chapter 2. Markup and Core Concepts
2.1 Tags
Table 2-1. Types of tags in XML
Figure 2-1. Telegram with element boundaries visible
2.2 Documents
Figure 2-2. Parts of an XML document
2.3 The Document Prolog
Example 2-1. A document with a full prolog
2.3.1 The XML Declaration
Figure 2-3. Form of the XML declaration
2.3.2 The Document Type Declaration
Figure 2-4. Form of the document type declaration
2.3.2.1 System and public identifiers
Figure 2-5. Form of the system identifier
Figure 2-6. Form of the public identifier
2.3.2.2 Declarations
Figure 2-7. Form of an entity declaration
Figure 2-8. Form of an entity reference
2.4 Elements
2.4.1 Syntax
Figure 2-9. Container element syntax
Figure 2-10. Empty element syntax
Figure 2-11. Form of an attribute
2.4.2 Attributes
2.4.3 Namespaces
Example 2-2. Document with two namespaces
Figure 2-12. Namespace declaration syntax
Figure 2-13. Fully qualified name
2.4.4 Whitespace
2.4.5 Trees
Figure 2-14. A document tree
Figure 2-15. Depth-first search
Figure 2-16. Genealogical concepts
2.5 Entities
Figure 2-17. Entity types
2.5.1 Character Entities
Figure 2-18. Numeric character reference (decimal)
Figure 2-19. Numeric character entity reference (hexadecimal)
2.5.2 Mixed-Content Entities
2.5.2.1 Internal entities
2.5.2.2 External entities
Figure 2-20. Document with external entities
2.5.3 Unparsed Entities
2.6 Miscellaneous Markup
2.6.1 Comments
Figure 2-21. Comment syntax
2.6.2 CDATA Sections
Figure 2-22. CDATA section syntax
2.6.3 Processing Instructions
Figure 2-23. Processing instruction syntax
Chapter 3. Modeling Information
3.1 Simple Data Storage
3.1.1 Dictionaries
Figure 3-1. Apple's Property List Editor
3.1.2 Records
Example 3-1. A checkbook document
Example 3-2. A tabulate program
3.1.3 XML and Databases
Example 3-3. An XML document to put in a database
3.2 Narrative Documents
Figure 3-2. Flows, blocks, inlines
3.2.1 Flows and Sections
3.2.2 Blocks and Inlines
3.2.3 Complex Structures
3.2.4 Metadata
3.2.5 Linked Objects
3.2.6 XHTML
Example 3-4. An XHTML document
3.2.7 DocBook
Example 3-5. A DocBook reference page
Example 3-6. A DocBook book
3.2.7.1 Notes
3.3 Complex Data
3.3.1 Elements as Objects
Example 3-7. An SVG document
Example 3-8. A molecule definition in MoDL
3.3.2 Presentation Versus Conceptual Encoding
Figure 3-3. A complex fraction
Example 3-9. Presentation encoding in MathML
Example 3-10. Content encoding in MathML
3.4 Documents Describing Documents
3.4.1 Describing Media
Example 3-11. RSS describing a web site
3.4.2 Templates
Chapter 4. Quality Control with Schemas
4.1 Basic Concepts
4.1.1 Validation
4.1.2 A History of Schema Languages
4.1.2.1 DTD
4.1.2.2 W3C XML Schema
4.1.2.3 RELAX NG
4.1.2.4 Schematron
4.1.3 Do You Need Schemas?
4.2 DTDs
4.2.1 Document Prolog
4.2.2 Declarations
4.2.3 An Example
Example 4-1. A typical CensusML document
Example 4-2. The CensusML DTD
4.2.4 Tips for Designing and Customizing DTDs
4.2.4.1 Keeping it organized
4.2.4.2 Attributes versus elements
4.2.4.3 Modularization
4.2.4.4 Importing modules from external sources
4.2.4.5 Conditional sections
4.2.4.6 Using the internal subset
4.2.5 SimpleDoc: A Narrative Example
Example 4-3. A sample SimpleDoc document
Example 4-4. The SimpleDoc DTD
4.3 W3C XML Schema
Example 4-5. A bad CensusML document
Table 4-1. Simple types commonly used in schemas
Example 4-6. A schema for CensusML
4.4 RELAX NG
Example 4-7. A simple RELAX NG schema
4.4.1 Elements
4.4.1.1 Repetition
4.4.1.2 Choices
4.4.1.3 Grouping
4.4.1.4 Nonelement content descriptors
4.4.2 Data Typing
4.4.2.1 String and token
4.4.2.2 Parameters
4.4.3 Attributes
4.4.4 Namespaces
4.4.5 Name Classes
4.4.6 Named Patterns
4.4.6.1 Recursive definitions
4.4.6.2 Aggregate definitions
4.4.7 Modularity
4.4.7.1 External references
4.4.7.2 Nested grammars
Example 4-8. para.rng
Example 4-9. footnote.rng
4.4.7.3 Merging grammars
4.4.7.4 Overriding imported definitions
4.4.8 CensusML Example
Example 4-10. A RELAX NG schema for CensusML
4.5 Schematron
4.5.1 Overview
Figure 4-1. A Schematron report
4.5.2 Abstract Rules
4.6 Schemas Compared
Table 4-2. A comparison of schema
Chapter 5. Presentation Part I: CSS
5.1 Stylesheets
5.1.1 Why We Need Them
Figure 5-1. One stylesheet used by many documents
Figure 5-2. Mixing and matching stylesheets for different purposes
5.1.2 How They Work
5.1.2.1 Applying properties
Figure 5-3. A stylesheet used to help produce a formatted document
5.1.2.2 Client and server-side processing
5.1.2.3 Cascading styles
Figure 5-4. A cascade of stylesheets
5.1.2.4 Associating a stylesheet to a document
Figure 5-5. Syntax for a stylesheet declaration
5.1.3 Limitations
5.2 CSS Basics
5.2.1 The CSS Specification
5.2.2 Syntax
Figure 5-6. CSS rule syntax
5.2.3 Matching Properties to Elements
5.2.4 Property Inheritance
5.2.5 Combining Stylesheets
5.3 Rule Matching
Figure 5-7. Syntax for a CSS selector
5.3.1 Elements
5.3.2 Attributes
5.3.3 Contextual Selection
5.3.3.1 Ancestry
5.3.3.2 Position
Figure 5-8. Autogenerated text in an admonition object
5.3.4 Resolving Property Conflicts
5.4 Properties
5.4.1 Inheritance
Figure 5-9. Element-inheriting properties
5.4.2 Units of Measurement
5.4.3 Display Types
5.4.4 Blockish Properties
Figure 5-10. The CSS box model
5.4.4.1 Margins
5.4.4.2 Borders
5.4.4.3 Padding
Figure 5-11. A warning inside a border
5.4.4.4 Alignment and indentation
5.4.5 Text Properties
5.4.5.1 Font family
Figure 5-12. Generic font families
5.4.5.2 Font size
Figure 5-13. Font sizes
5.4.5.3 Line height and font size adjustment
5.4.5.4 Font style and weight
Figure 5-14. Font styles and weights
5.4.5.5 Color
Table 5-1. Color selections
5.4.6 Generated Text
5.4.6.1 Counters
5.5 Examples
Example 5-1. An XHTML document with DIVs and SPANs
Example 5-2. A CSS stylesheet for an XHTML document
Figure 5-15. Browser view of the XHTML document
Example 5-3. A CSS Stylesheet for a DocBook reference page
Figure 5-16. Browser view of the CSS-formatted DocBook document
Chapter 6. XPath and XPointer
6.1 Nodes and Trees
6.1.1 Node Types
Figure 6-1. Tree view showing all kinds of nodes
6.1.2 Trees and Subtrees
6.2 Finding Nodes
Table 6-1. Node axes
Table 6-2. Node tests
Table 6-3. Location path shortcuts
Example 6-1. A sample XML document
Table 6-4. Location path examples
Table 6-5. XPath predicates
6.3 XPath Expressions
6.3.1 Boolean Expressions
Table 6-6. Boolean conversion rules
Table 6-7. Comparison operators
Table 6-8. Boolean functions
6.3.2 Node Set Expressions
Table 6-9. Node set functions
6.3.3 Numeric Expressions
Table 6-10. Rules to convert expressions into numbers
Table 6-11. Numeric operators and functions
6.3.4 String Expressions
Table 6-12. Rules to convert expressions into strings
Table 6-13. Functions that create strings
Table 6-14. Functions that operate on strings
6.4 XPointer
Whatever Happened to XLink?
6.4.1 Syntax
6.4.1.1 Schemes and chained xpointers
6.4.1.2 Shorthand pointers
6.4.2 Points
Figure 6-2. Character points
6.4.3 Character Escaping
6.4.4 XPointer Functions
6.4.4.1 Constructing ranges
6.4.4.2 Ranges from points and nodes
6.4.4.3 Ranges from strings
6.4.4.4 Finding range endpoints
6.4.4.5 Returning points from documents
Chapter 7. Transformation with XSLT
7.1 History
7.2 Concepts
Example 7-1. Instruction guide for a model rocket
Example 7-2. XSLT stylesheet for the instruction guide
7.3 Running Transformations
7.4 The stylesheet Element
7.5 Templates
7.5.1 Matching Nodes
7.5.2 Resolving Conflicts Among Rules
7.5.3 Default Rules
7.5.4 Redirecting Processing
7.5.4.1 The apply-templates instruction
7.5.4.2 The for-each instruction
7.5.5 Named Templates
7.5.5.1 The call-template directive
7.5.5.2 Parameters
7.6 Formatting
7.6.1 Setting the Output Mode
7.6.2 Outputting Node Values
7.6.3 Variables
7.6.4 Creating Nodes
7.6.4.1 Elements
7.6.4.2 Attributes and attribute sets
7.6.4.3 Text nodes
7.6.4.4 Processing instructions and comments
7.6.5 Numeric Text
Table 7-1. Number formats
7.6.6 Sorting
7.6.7 Handling Whitespace
7.6.8 Example: A Checkbook
Example 7-3. Checkbook document
Example 7-4. Checkbook transformation stylesheet
Example 7-5. The result tree
Figure 7-1. Checkbook statistics in Netscape
7.6.9 Combining Stylesheets
7.6.10 Modes
Chapter 8. Presentation Part II: XSL-FO
8.1 How It Works
8.1.1 Formatting
Figure 8-1. The XSL-FO formatting process
8.1.2 Formatting Objects
8.1.3 Print, Screen, and Beyond
8.1.4 Formatters
8.2 A Quick Example
Example 8-1. An XSLT stylesheet to turn mydoc into a formatting object tree
Figure 8-2. The message formatted
8.3 The Area Model
Figure 8-3. The area model
8.3.1 Area Stacking
Figure 8-4. Chinese text, showing block- and inline-progression directions
Figure 8-5. Italian text, showing block- and inline-progression directions
8.3.2 Dimensions
Table 8-1. Unit abbreviations
8.4 Formatting Objects
8.4.1 Page Layout
8.4.1.1 Page sequence masters
8.4.1.2 Page masters
Figure 8-6. Page regions
8.4.2 Flows
8.4.3 Blocks
8.4.3.1 Spacing properties
Figure 8-7. The article formatted
8.4.3.2 Background properties
8.4.3.3 Border properties
8.4.3.4 Font properties
8.4.4 Inlines
8.4.4.1 The inline FO
8.4.4.2 Inline formatting without containment
8.4.4.3 Graphics
8.4.4.4 Generated content
8.5 An Example: TEI
Example 8-2. A TEI-XML document
TEI
Example 8-3. XSLT stylesheet for the TEI-XML document
Example 8-4. Formatting object tree of the TEI document
Figure 8-8. The sonnet in PDF
8.6 A Bigger Example: DocBook
8.6.1 Page Masters
8.6.2 Page Sequence Masters
8.6.3 Top-Level Elements and Flows
8.6.4 Simple Blocks
8.6.5 Lists
Figure 8-9. The structure of lists
8.6.6 Footnotes
8.6.7 Tables
Figure 8-10. The structure of tables
8.6.8 Inlines
8.6.9 Results
Figure 8-11. A screenshot of the middle of the page
Figure 8-12. A screenshot of a footer
Figure 8-13. A screenshot of a table
Figure 8-14. A screenshot of the whole page
Chapter 9. Internationalization
9.1 Character Encodings
9.1.1 Specifying an Encoding
9.1.2 Basic Concepts
Figure 9-1. The US-ASCII character set
9.1.3 Unicode and UCS
9.1.4 Common Encodings
9.1.4.1 ISO 8859
Table 9-1. ISO character encodings
9.1.4.2 UCS-2 and UCS-4
9.1.4.3 UTF-8
Table 9-2. UTF-8 Encoding Algorithm for UCS
9.1.4.4 UTF-16
9.1.5 Character References
9.2 MIME and Media Types
9.3 Specifying Human Languages
9.3.1 The xml:lang Attribute and Language Codes
9.3.2 Language Support in Stylesheets
9.3.2.1 CSS and the :lang( ) pseudo-class
9.3.2.2 XSLT and the lang( ) function
Chapter 10. Programming
10.1 Limitations
10.2 Streams and Events
Example 10-1. A simple XML document with lots of markup types
10.3 Trees and Objects
10.4 Pull Parsing
10.5 Standard APIs
10.6 Choosing a Parser
Table 10-1. Some popular XML parsers
10.7 PYX
Table 10-2. PYX notation
10.8 SAX
10.8.1 Drivers
Figure 10-1. ParserFactory
10.8.2 A Java Example: Element Counter
Example 10-2. Contents of SAXCounter.java
Example 10-3. Contents of SAXCounterHandler.java
Example 10-4. Contents of text.xml
10.9 DOM
10.9.1 Class Interface Reference
10.9.1.1 Document
10.9.1.1.1 Properties
10.9.1.1.2 Methods
10.9.1.2 DocumentFragment
10.9.1.3 DocumentType
10.9.1.3.1 Properties
10.9.1.4 Node
10.9.1.4.1 Properties
10.9.1.4.2 Methods
10.9.1.5 NodeList
10.9.1.5.1 Properties
10.9.1.5.2 Methods
10.9.1.6 NamedNodeMap
10.9.1.6.1 Properties
10.9.1.6.2 Methods
10.9.1.7 CharacterData
10.9.1.7.1 Properties
10.9.1.7.2 Methods
10.9.1.8 Element
10.9.1.8.1 Properties
10.9.1.8.2 Methods
10.9.1.9 Attr
10.9.1.9.1 Properties
10.9.1.10 Text
10.9.1.10.1 Methods
10.9.1.11 CDATASection
10.9.1.12 ProcessingInstruction
10.9.1.12.1 Properties
10.9.1.13 Comment
10.9.1.14 EntityReference
10.9.1.15 Entity
10.9.1.15.1 Properties
10.9.1.16 Notation
10.9.1.16.1 Properties
10.9.2 An Example in Perl
Example 10-5. A DOM program for moving indexterms out of titles
10.10 Other Options
10.10.1 XPath as API
10.10.2 JDOM
10.10.3 Hybrids
10.10.4 Data Binding
Appendix A. Resources
A.1 Online
A.2 Books
A.3 Standards Organizations
A.4 Tools
A.5 Miscellaneous
Appendix B. A Taxonomy of Standards
B.1 Markup and Structure
Status
Description
Status
Description
Status
Description
Status
Description
Status
Description
Status
Description
Status
Description
B.2 Linking
Status
Description
Status
Description
Status
Description
B.3 Addressing and Querying
Status
Description
Status
Description
Status
Description
B.4 Style and Transformation
Status
Description
Status
Description
Status
Description
B.5 Programming
Status
Description
Status
Description
Status
Description
Status
Description
B.6 Publishing
Status
Description
B.7 Hypertext
Status
Description
Status
Description
B.8 Descriptive/Procedural
Status
Description
Status
Description
B.9 Multimedia
Status
Description
Status
Description
B.10 Science
Status
Description
Glossary
A
B
C
D
E
F
H
I
L
M
N
O
P
Q
R
S
T
U
W
X
← Prev
Back
Next →
← Prev
Back
Next →