XML Essentials

Using's XML Data Format

Table of Contents

Who Should Read This Book?
Who Should Not Read This Book?
About the Examples
Organization of This Book
Conventions Used in This Book
How to Contact Us
1. The File Format
The Proprietary World
The Approach
Inside an file
The manifest.xml File
Unpacking and Packing files
Dynamically Viewing a Document’s XML
The Virtues of Cheating
2. The meta.xml, styles.xml, settings.xml, and content.xml Files
The settings.xml File
Configuration Items
Named Item Maps
Indexed Item Maps
The meta.xml File
The Dublin Core Elements
Elements from the meta Namespace
Time and Duration Formats
Case Study: Extracting Meta-Information
The Meta Extraction Program
The styles.xml File
Font Declarations
Office Default and Named Styles
The content.xml File
3. Text Document Basics
Characters and Paragraphs
Defining Paragraphs and Headings
Character and Paragraph Styles
Asian and Complex Text Layout Characters
Case Study: Extracting Headings
Specifying a Page Master
Master Styles
Pages in the content.xml file
Bulleted, Numbered, and Outlined Lists
Case Study: Adding Headings to a Document
4. Text Documents—Advanced
Style Information for Frames
Body Information for Frames
Inserting Images in Text
Style Information for Images in Text
Body Information for Images in Text
Background Images
Date and Time Fields
Page Numbering
Document Information
Tracking Changes
Tables in Text Documents
Text Table Style Information
Text Table Body Information
Merged Cells
Case Study: Creating a Table of Changes
5. Spreadsheets
Spreadsheet Information in styles.xml
Spreadsheet Information in content.xml
Column Styles
Row Styles
Styles for the Sheet as a Whole
Number Styles
Internationalizing Number Styles
Cell Styles
Table Content
Columns and Rows
String content Table Cells
Numeric Content in Table Cells
Formula Content in Table Cells
Merged Cells in Spreadsheets
Case Study: Modifying a Spreadsheet
Main Program
Getting Parameters
Converting the XML
DOM Utilities
Parsing the Format Strings
Print Ranges
Case Study: Creating a Spreadsheet
6. Drawings
A Drawing’s styles.xml File
A Drawing’s content.xml File
Line Attributes
Measure Lines
Attaching Text to a Line
Basic Shapes
Fill Styles
Drop Shadows
Circles and Ellipses
Arcs and Segments
Polylines, Polygons, and Free Form Curves
Adding Text to Drawings
Rotation of objects
Case Study: Weather Diagram
Styles for the Weather Drawing
Objects in the Weather Drawing
Grouping Objects
Custom Glue Points
Three-dimensional Graphics
The dr3d:scene element
The Object
Extruded Objects
Styles for 3-D Objects
7. Presentation
Presentation Styles in styles.xml
Page Layouts in styles.xml
Master Styles in styles.xml
A Presentation’s content.xml File
Text Boxes in a Presentation
Images and Objects in a Presentation
Text Animation
Interaction in Presentations
Case Study: Creating a Slide Show
8. Charts
Chart Terminology
Charts are Objects
Common Attributes for <draw:object>
Charts in Word Processing Documents
Charts in Drawings
Charts in Spreadsheets
Chart Contents
The Plot Area
The Chart Data Table
Case Study - Creating Pie Charts
Three-D Charts
9. Filters
The Foreign File Format
Building the Import Filter
Building the Export Filter
Installing a Filter
A. The XML You Need for
What is XML?
Anatomy of an XML Document
Elements and Attributes
Name Syntax
Entity References
Character References
Character Encodings
Unicode Encoding Schemes
Other Character Encodings
Document Type Definitions (DTDs)
Putting It Together
XML Namespaces
Tools for Processing XML
Selecting a Parser
XSLT Processors
B. The XSLT You Need for
XSLT Default Processing
Adding Your Own Templates
Selecting Nodes to Process
Conditional Processing in XSLT
XSLT Functions
XSLT Variables
Named Templates, Calls, and Parameters
C. Utilities for Documents
An XSLT Transformation
Getting Rid of the DTD
The Transformation Program
Transformation Script
Using XSLT to Indent Documents
An XSLT Framework for Documents White Space Representation
Showing Meta-information Using SAX
Creating Multiple Directory Levels

List of Figures

1.1. Text Document
2.1. General Document Properties
2.2. Document Description
2.3. User-defined Information
2.4. Document Statistics
3.1. Document with Mixed Languages
3.2. Document Created with Whitespace XSLT Extension
3.3. Format Menu
3.4. Styled Headings
3.5. Tab Stops in
3.6. Column Spacing
3.7. Relationship Among Files When Specifying Pages
3.8. Relationship Among Elements When Specifying Lists
3.9. Screenshot of an Outline List
4.1. Graphics Object Toolbar
4.2. Footnotes and Endnotes
4.3. Document with Changes Tracked
4.4. Table Width and Spacing
4.5. Other Table Properties
4.6. Cells Spanning Rows
4.7. Change Summary, Sorted by Time
5.1. Spreadsheet Page Options
5.2. Number Styles Dialog
5.3. Spreadsheet Print Ranges
5.4. Result of Gradebook Transformation
6.1. Measure Line for a Horizontal Line
6.2. Arrow Labelled with Text
6.3. Effect of Border on Gradients
6.4. Effect of Angle on Gradients
6.5. Effect of Center Coordinates on Gradients
6.6. Simple Polyline
6.7. Callout Text in a Drawing
6.8. Graphic weather template
6.9. Finished Weather Report Drawing
6.10. Default Glue Points
6.11. Custom Glue Points
6.12. Path for a Cone, Shell, and Half-Sphere
6.13. Flat-shaded Spheres with Differing Numbers of Segments
6.14. Gouraud-shaded Spheres with Differing Numbers of Segments
8.1. Chart Derived from Spreadsheet
8.2. Chart with Series in Rows
8.3. Scatter Chart
8.4. Chart With Even-Staggered Labels
8.5. Spreadsheet with Survey Responses
8.6. Text Document with Survey Responses
8.7. Insufficient Three-Dimensional Information
9.1. Imported Club Database
9.2. Styles in Writer Template
9.3. General Filter Information
9.4. Filetype in File Dialog
9.5. Filter Transformation Information
B.1. Tree Representation of Sample Document

List of Examples

1.1. Listing of Unzipped Text Document
1.2. Program to Unpack an Document
1.3. Program to Pack Files to Create an Document
2.1. Example of Configuration Items
2.2. Program
2.3. Program
2.4. Style Defintion in a Word Processing Document
2.5. Style Defintion in a Spreadsheet Document
2.6. Style Defintion in a Drawing Document
2.7. Structure of the content.xml file
3.1. Representation of Whitespace
3.2. XSLT Templates for Expanding Whitespace
3.3. Test XML file for Whitespace Conversion
3.4. Test XML file for Whitespace Conversion
3.5. Font Declarations Include File
3.6. Using an Included Font Declaration File
3.7. Markup for <text:h>
3.8. Border Specification
3.9. Various Tab Stops
3.10. Extracting Headings from an Document
3.11. Representation of Sections
3.12. Using a Section Style
3.13. Full Page Master Specification
3.14. Minimal Page Master Specification
3.15. Master Styles
3.16. Using Master Pages in content.xml
3.17. XML for an Outline List
4.1. XML Representation of a Frame
4.2. Footnote and Endnote XML
4.3. Change Tracking
4.4. XML Representation of Change Tracking
4.5. Three by Two table without Repeating Headers
4.6. Cells Spanning Columns
4.7. XML for Cells Spanning Rows
5.1. Page Options
5.2. Style Information for a Sheet
5.3. Number Style for format #,##0.00
5.4. Number Style for format -#,##0.00 with Negative Values in Red
5.5. Scientific Notation for Format 0.00E+00
5.6. Fraction Style for Format # ??/??
5.7. Percent Style for Format #,##0.00%
5.8. Currency in Format -$#,##0.00
5.9. Currency Format for Greek Drachma
5.10. Date Styles
5.11. Time Style
5.12. Style for a Numeric Cell
5.13. Table Columns in a Spreadsheet
5.14. Table Cell Values
5.15. Return Types from Formulas
5.16. Minimal Formulas
5.17. Money Conversion Parameters
5.18. Structure of Print Ranges
5.19. Sample Gradebook Data
6.1. Master Styles in a Draw Document
6.2. Simple Horizontal Line
6.3. Style for a Simple Line
6.4. Non-continuous Line
6.5. Double Arrow Marker
6.6. XML for a Measure Line
6.7. XML for Labelled Arrow
6.8. Styles for Labelled Line
6.9. Solid Fill Style
6.10. XML Representation of Gradients
6.11. XML for Hatch Fill
6.12. XML for Bitmap Fill
6.13. XML for a Rectangle
6.14. XML for Circle and Ellipse
6.15. XML for Arcs and Segments
6.16. XML for a Polyline
6.17. Simple Text Box
6.18. XML for Callout Text
6.19. XML for Custom Glue Points
6.20. XML for a Cylinder
7.1. Structure of a styles.xml file
7.2. Text Boxes for a Page with Title and Two Outlines
7.3. Clip Art and Spreadsheet in a Presentation
7.4. Presentation Notes
7.5. XML for Presentation Actions Requiring Extra Information
8.1. XML for a Chart in a Word Processing Document
8.2. XML for Chart in Spreadsheet
8.3. Example of Chart Title and Subtitle
8.4. Plot Area and Style
8.5. Styles and Content for a Bar Chart
8.6. Styles for Bar Chart Excerpt
8.7. Table for Bar Chart
8.8. Shell Script for Chart Document Creation
9.1. Sample Club Database
9.2. Stylesheet for Transforming Club List to Writer Document
B.1. Sample XML Document
B.2. Simple Templates
B.3. Gradebook Data in XML
B.4. Complex XPath Selector
B.5. Using <xsl:if>
B.6. Example of <xsl:choose>
B.7. Setting Variables
B.8. Named XSLT Template
B.9. XLST Template with Parameters
B.10. Calling an XSLT Template with a Parameter
C.1. Entity Resolver to Ignore DTDs
C.2. XSLT Transformation for documents
C.3. Invoking the Transform Program
C.4. XSLT Transformation for Indenting
C.5. Program to Indent XML Files via XSLT
C.6. XSLT Framework for Transforming Documents
C.7. Transforming Whitespace to XML
C.8. Program
C.9. Program to Create Directories

Creative Commons License Content licensed under a Creative Commons License.
All content is copyright O’Reilly & Associates, Inc.
During development, I give permission for non-commercial copying for educational and review purposes. After publication, all text will be released under the Free Software Foundation’s GNU Free Documentation License.