You are previewing Learning XML, 2nd Edition.
O'Reilly logo
Learning XML, 2nd Edition

Book Description

This second edition of the bestselling Learning XML provides web developers with a concise but grounded understanding of XML (the Extensible Markup Language) and its potential-- not just a whirlwind tour of XML. The author explains the important and relevant XML technologies and their capabilities clearly and succinctly with plenty of real-life projects and useful examples. He outlines the elements of markup--demystifying concepts such as attributes, entities, and namespaces--and provides enough depth and examples to get started. Learning XML is a reliable source for anyone who needs to know XML, but doesn't want to waste time wading through hundreds of web sites or 800 pages of bloated text. For writers producing XML documents, this book clarifies files and the process of creating them with the appropriate structure and format. Designers will learn what parts of XML are most helpful to their team and will get started on creating Document Type Definitions. For programmers, the book makes syntax and structures clear. Learning XML also discusses the stylesheets needed for viewing documents in the next generation of browsers, databases, and other devices. Learning XML illustrates the core XML concepts and language syntax, in addition to important related tools such as the CSS and XSL styling languages and the XLink and XPointer specifications for creating rich link structures. It includes information about three schema languages for validation: W3C Schema, Schematron, and RELAX-NG, which are gaining widespread support from people who need to validate documents but aren't satisfied with DTDs. Also new in this edition is a chapter on XSL-FO, a powerful formatting language for XML. If you need to wade through the acronym soup of XML and start to really use this powerful tool, Learning XML, will give you the roadmap you need.

Table of Contents

  1. Learning XML, 2nd Edition
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. What's Inside
    2. Style Conventions
    3. Examples
    4. Comments and Questions
    5. Acknowledgments
  5. 1. Introduction
    1. 1.1. What Is XML?
      1. 1.1.1. An Information Container
      2. 1.1.2. A Markup Language Toolkit
        1. 1.1.2.1. Well-formedness
        2. 1.1.2.2. Validity
        3. 1.1.2.3. Document type definitions (DTDs)
        4. 1.1.2.4. Schemas
      3. 1.1.3. An Open Standard
      4. 1.1.4. A Constellation of Standards
    2. 1.2. Where Did XML Come From?
      1. 1.2.1. History
      2. 1.2.2. The Goals of XML
    3. 1.3. What Can I Do with XML?
      1. 1.3.1. Store and Retrieve Data
      2. 1.3.2. Format Documents
        1. 1.3.2.1. CSS
        2. 1.3.2.2. Transformation to presentational formats
        3. 1.3.2.3. Transformation and formatting objects
        4. 1.3.2.4. Programming solutions
      3. 1.3.3. Ensure Data Integrity
      4. 1.3.4. Support Multiple Languages
    4. 1.4. How Do I Get Started?
      1. 1.4.1. Authoring Documents
      2. 1.4.2. Viewing Documents
      3. 1.4.3. Parsing
      4. 1.4.4. Transformation
      5. 1.4.5. Formatting for Print
      6. 1.4.6. Programming
  6. 2. Markup and Core Concepts
    1. 2.1. Tags
    2. 2.2. Documents
    3. 2.3. The Document Prolog
      1. 2.3.1. The XML Declaration
      2. 2.3.2. The Document Type Declaration
        1. 2.3.2.1. System and public identifiers
        2. 2.3.2.2. Declarations
    4. 2.4. Elements
      1. 2.4.1. Syntax
      2. 2.4.2. Attributes
      3. 2.4.3. Namespaces
      4. 2.4.4. Whitespace
      5. 2.4.5. Trees
    5. 2.5. Entities
      1. 2.5.1. Character Entities
      2. 2.5.2. Mixed-Content Entities
        1. 2.5.2.1. Internal entities
        2. 2.5.2.2. External entities
      3. 2.5.3. Unparsed Entities
    6. 2.6. Miscellaneous Markup
      1. 2.6.1. Comments
      2. 2.6.2. CDATA Sections
      3. 2.6.3. Processing Instructions
  7. 3. Modeling Information
    1. 3.1. Simple Data Storage
      1. 3.1.1. Dictionaries
      2. 3.1.2. Records
      3. 3.1.3. XML and Databases
    2. 3.2. Narrative Documents
      1. 3.2.1. Flows and Sections
      2. 3.2.2. Blocks and Inlines
      3. 3.2.3. Complex Structures
      4. 3.2.4. Metadata
      5. 3.2.5. Linked Objects
      6. 3.2.6. XHTML
      7. 3.2.7. DocBook
        1. 3.2.7.1. Notes
    3. 3.3. Complex Data
      1. 3.3.1. Elements as Objects
      2. 3.3.2. Presentation Versus Conceptual Encoding
    4. 3.4. Documents Describing Documents
      1. 3.4.1. Describing Media
      2. 3.4.2. Templates
  8. 4. Quality Control with Schemas
    1. 4.1. Basic Concepts
      1. 4.1.1. Validation
      2. 4.1.2. A History of Schema Languages
        1. 4.1.2.1. DTD
        2. 4.1.2.2. W3C XML Schema
        3. 4.1.2.3. RELAX NG
        4. 4.1.2.4. Schematron
      3. 4.1.3. Do You Need Schemas?
    2. 4.2. DTDs
      1. 4.2.1. Document Prolog
      2. 4.2.2. Declarations
      3. 4.2.3. An Example
      4. 4.2.4. Tips for Designing and Customizing DTDs
        1. 4.2.4.1. Keeping it organized
        2. 4.2.4.2. Attributes versus elements
        3. 4.2.4.3. Modularization
        4. 4.2.4.4. Importing modules from external sources
        5. 4.2.4.5. Conditional sections
        6. 4.2.4.6. Using the internal subset
      5. 4.2.5. SimpleDoc: A Narrative Example
    3. 4.3. W3C XML Schema
    4. 4.4. RELAX NG
      1. 4.4.1. Elements
        1. 4.4.1.1. Repetition
        2. 4.4.1.2. Choices
        3. 4.4.1.3. Grouping
        4. 4.4.1.4. Nonelement content descriptors
      2. 4.4.2. Data Typing
        1. 4.4.2.1. String and token
        2. 4.4.2.2. Parameters
      3. 4.4.3. Attributes
      4. 4.4.4. Namespaces
      5. 4.4.5. Name Classes
      6. 4.4.6. Named Patterns
        1. 4.4.6.1. Recursive definitions
        2. 4.4.6.2. Aggregate definitions
      7. 4.4.7. Modularity
        1. 4.4.7.1. External references
        2. 4.4.7.2. Nested grammars
        3. 4.4.7.3. Merging grammars
        4. 4.4.7.4. Overriding imported definitions
      8. 4.4.8. CensusML Example
    5. 4.5. Schematron
      1. 4.5.1. Overview
      2. 4.5.2. Abstract Rules
    6. 4.6. Schemas Compared
  9. 5. Presentation Part I: CSS
    1. 5.1. Stylesheets
      1. 5.1.1. Why We Need Them
      2. 5.1.2. How They Work
        1. 5.1.2.1. Applying properties
        2. 5.1.2.2. Client and server-side processing
        3. 5.1.2.3. Cascading styles
        4. 5.1.2.4. Associating a stylesheet to a document
      3. 5.1.3. Limitations
    2. 5.2. CSS Basics
      1. 5.2.1. The CSS Specification
      2. 5.2.2. Syntax
      3. 5.2.3. Matching Properties to Elements
      4. 5.2.4. Property Inheritance
      5. 5.2.5. Combining Stylesheets
    3. 5.3. Rule Matching
      1. 5.3.1. Elements
      2. 5.3.2. Attributes
      3. 5.3.3. Contextual Selection
        1. 5.3.3.1. Ancestry
        2. 5.3.3.2. Position
      4. 5.3.4. Resolving Property Conflicts
    4. 5.4. Properties
      1. 5.4.1. Inheritance
      2. 5.4.2. Units of Measurement
      3. 5.4.3. Display Types
      4. 5.4.4. Blockish Properties
        1. 5.4.4.1. Margins
        2. 5.4.4.2. Borders
        3. 5.4.4.3. Padding
        4. 5.4.4.4. Alignment and indentation
      5. 5.4.5. Text Properties
        1. 5.4.5.1. Font family
        2. 5.4.5.2. Font size
        3. 5.4.5.3. Line height and font size adjustment
        4. 5.4.5.4. Font style and weight
        5. 5.4.5.5. Color
      6. 5.4.6. Generated Text
        1. 5.4.6.1. Counters
    5. 5.5. Examples
  10. 6. XPath and XPointer
    1. 6.1. Nodes and Trees
      1. 6.1.1. Node Types
      2. 6.1.2. Trees and Subtrees
    2. 6.2. Finding Nodes
    3. 6.3. XPath Expressions
      1. 6.3.1. Boolean Expressions
      2. 6.3.2. Node Set Expressions
      3. 6.3.3. Numeric Expressions
      4. 6.3.4. String Expressions
    4. 6.4. XPointer
      1. 6.4.1. Syntax
        1. 6.4.1.1. Schemes and chained xpointers
        2. 6.4.1.2. Shorthand pointers
      2. 6.4.2. Points
      3. 6.4.3. Character Escaping
      4. 6.4.4. XPointer Functions
        1. 6.4.4.1. Constructing ranges
        2. 6.4.4.2. Ranges from points and nodes
        3. 6.4.4.3. Ranges from strings
        4. 6.4.4.4. Finding range endpoints
        5. 6.4.4.5. Returning points from documents
  11. 7. Transformation with XSLT
    1. 7.1. History
    2. 7.2. Concepts
    3. 7.3. Running Transformations
    4. 7.4. The stylesheet Element
    5. 7.5. Templates
      1. 7.5.1. Matching Nodes
      2. 7.5.2. Resolving Conflicts Among Rules
      3. 7.5.3. Default Rules
      4. 7.5.4. Redirecting Processing
        1. 7.5.4.1. The apply-templates instruction
        2. 7.5.4.2. The for-each instruction
      5. 7.5.5. Named Templates
        1. 7.5.5.1. The call-template directive
        2. 7.5.5.2. Parameters
    6. 7.6. Formatting
      1. 7.6.1. Setting the Output Mode
      2. 7.6.2. Outputting Node Values
      3. 7.6.3. Variables
      4. 7.6.4. Creating Nodes
        1. 7.6.4.1. Elements
        2. 7.6.4.2. Attributes and attribute sets
        3. 7.6.4.3. Text nodes
        4. 7.6.4.4. Processing instructions and comments
      5. 7.6.5. Numeric Text
      6. 7.6.6. Sorting
      7. 7.6.7. Handling Whitespace
      8. 7.6.8. Example: A Checkbook
      9. 7.6.9. Combining Stylesheets
      10. 7.6.10. Modes
  12. 8. Presentation Part II: XSL-FO
    1. 8.1. How It Works
      1. 8.1.1. Formatting
      2. 8.1.2. Formatting Objects
      3. 8.1.3. Print, Screen, and Beyond
      4. 8.1.4. Formatters
    2. 8.2. A Quick Example
    3. 8.3. The Area Model
      1. 8.3.1. Area Stacking
      2. 8.3.2. Dimensions
    4. 8.4. Formatting Objects
      1. 8.4.1. Page Layout
        1. 8.4.1.1. Page sequence masters
        2. 8.4.1.2. Page masters
      2. 8.4.2. Flows
      3. 8.4.3. Blocks
        1. 8.4.3.1. Spacing properties
        2. 8.4.3.2. Background properties
        3. 8.4.3.3. Border properties
        4. 8.4.3.4. Font properties
      4. 8.4.4. Inlines
        1. 8.4.4.1. The inline FO
        2. 8.4.4.2. Inline formatting without containment
        3. 8.4.4.3. Graphics
        4. 8.4.4.4. Generated content
    5. 8.5. An Example: TEI
    6. 8.6. A Bigger Example: DocBook
      1. 8.6.1. Page Masters
      2. 8.6.2. Page Sequence Masters
      3. 8.6.3. Top-Level Elements and Flows
      4. 8.6.4. Simple Blocks
      5. 8.6.5. Lists
      6. 8.6.6. Footnotes
      7. 8.6.7. Tables
      8. 8.6.8. Inlines
      9. 8.6.9. Results
  13. 9. Internationalization
    1. 9.1. Character Encodings
      1. 9.1.1. Specifying an Encoding
      2. 9.1.2. Basic Concepts
      3. 9.1.3. Unicode and UCS
      4. 9.1.4. Common Encodings
        1. 9.1.4.1. ISO 8859
        2. 9.1.4.2. UCS-2 and UCS-4
        3. 9.1.4.3. UTF-8
        4. 9.1.4.4. UTF-16
      5. 9.1.5. Character References
    2. 9.2. MIME and Media Types
    3. 9.3. Specifying Human Languages
      1. 9.3.1. The xml:lang Attribute and Language Codes
      2. 9.3.2. Language Support in Stylesheets
        1. 9.3.2.1. CSS and the :lang( ) pseudo-class
        2. 9.3.2.2. XSLT and the lang( ) function
  14. 10. Programming
    1. 10.1. Limitations
    2. 10.2. Streams and Events
    3. 10.3. Trees and Objects
    4. 10.4. Pull Parsing
    5. 10.5. Standard APIs
    6. 10.6. Choosing a Parser
    7. 10.7. PYX
    8. 10.8. SAX
      1. 10.8.1. Drivers
      2. 10.8.2. A Java Example: Element Counter
    9. 10.9. DOM
      1. 10.9.1. Class Interface Reference
        1. 10.9.1.1. Document
          1. 10.9.1.1.1. Properties
          2. 10.9.1.1.2. Methods
        2. 10.9.1.2. DocumentFragment
        3. 10.9.1.3. DocumentType
          1. 10.9.1.3.1. Properties
        4. 10.9.1.4. Node
          1. 10.9.1.4.1. Properties
          2. 10.9.1.4.2. Methods
        5. 10.9.1.5. NodeList
          1. 10.9.1.5.1. Properties
          2. 10.9.1.5.2. Methods
        6. 10.9.1.6. NamedNodeMap
          1. 10.9.1.6.1. Properties
          2. 10.9.1.6.2. Methods
        7. 10.9.1.7. CharacterData
          1. 10.9.1.7.1. Properties
          2. 10.9.1.7.2. Methods
        8. 10.9.1.8. Element
          1. 10.9.1.8.1. Properties
          2. 10.9.1.8.2. Methods
        9. 10.9.1.9. Attr
          1. 10.9.1.9.1. Properties
        10. 10.9.1.10. Text
          1. 10.9.1.10.1. Methods
        11. 10.9.1.11. CDATASection
        12. 10.9.1.12. ProcessingInstruction
          1. 10.9.1.12.1. Properties
        13. 10.9.1.13. Comment
        14. 10.9.1.14. EntityReference
        15. 10.9.1.15. Entity
          1. 10.9.1.15.1. Properties
        16. 10.9.1.16. Notation
          1. 10.9.1.16.1. Properties
      2. 10.9.2. An Example in Perl
    10. 10.10. Other Options
      1. 10.10.1. XPath as API
      2. 10.10.2. JDOM
      3. 10.10.3. Hybrids
      4. 10.10.4. Data Binding
  15. A. Resources
    1. A.1. Online
    2. A.2. Books
    3. A.3. Standards Organizations
    4. A.4. Tools
    5. A.5. Miscellaneous
  16. B. A Taxonomy of Standards
    1. B.1. Markup and Structure
      1. XML 1.0
      2. XML 1.1
      3. Namespaces in XML
      4. Namespaces in XML 1.1
      5. W3C XML Schema
      6. RELAX NG
      7. Schematron
    2. B.2. Linking
      1. XLink
      2. XML Base
      3. XInclude
    3. B.3. Addressing and Querying
      1. XPath
      2. XPointer
      3. XQuery
    4. B.4. Style and Transformation
      1. CSS
      2. XSL
      3. XSLT
    5. B.5. Programming
      1. DOM
      2. SAX
      3. Canonical XML
      4. XML Signature
    6. B.6. Publishing
      1. DocBook
    7. B.7. Hypertext
      1. XHTML
      2. HTML
    8. B.8. Descriptive/Procedural
      1. SOAP
      2. RDF
    9. B.9. Multimedia
      1. SVG
      2. SMIL
    10. B.10. Science
      1. MathML
  17. Glossary
  18. Index
  19. About the Author
  20. Colophon
  21. Copyright