Home Page Icon
Home Page
Table of Contents for
III. Formatting and Displaying XML Documents
Close
III. Formatting and Displaying XML Documents
by Michael Morrison
Sams Teach Yourself XML in 24 Hours, Third Edition
Copyright
Dedication
About the Author
Acknowledgments
We Want to Hear from You!
Introduction
How This Book Is Structured
What You’ll Need
How to Use This Book
I. XML Essentials
1. Getting to Know XML
The What and Why of XML
A Quick History of HTML
Getting Multilingual with XML
The Convergence of HTML and XML
XML and Web Browsers
Real-World XML
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
2. Creating XML Documents
A Quick XML Primer
XML Building Blocks
Inside an Element
XML’s Five Commandments
Special XML Symbols
The XML Declaration
Selecting an XML Editor
Constructing Your First XML Document
Viewing Your XML Document
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
II. Defining XML Data
3. Defining Data with DTD Schemas
Creating Your Own Markup Languages
Schemas and XML Data Modeling
Document Type Definitions (DTDs)
XML Schema (XSDs)
Comparing Schema Technologies
The Importance of Document Validation
DTD Construction Basics
Breaking Down a DTD
Pondering Elements and Attributes
Digging Deeper into Elements
Peeking Inside Empty Elements
Housing Children with Element-Only Elements
Combining Content and Children with Mixed Elements
Keeping Your Options Open with Any Elements
Putting Attributes to Work
Working with Multiple Attributes
A Complete DTD Example
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
4. Digging Deeper into XML Documents
Leaving a Trail with Comments
Characters of Text in XML
The Wonderful World of Entities
Parsed Entities
General Entities
Parameter Entities
Unparsed Entities
Internal Versus External Entities
The Significance of Notations
Working with CDATA
Using XML to Create an Online Radio
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
5. Putting Namespaces to Use
Understanding Namespaces
Naming Namespaces
Declaring and Using Namespaces
Default Namespaces
Explicit Namespaces
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
6. Using SVG to Draw Scalable Graphics
What Is SVG?
Bitmap Versus Vector Graphics
SVG and Related Technologies
Microsoft’s Answer to Vector Graphics
Macromedia Flash
SVG for Mobile Devices
Inside the SVG Language
The Bare Bones of SVG
SVG Coordinate Systems
Creating an SVG Drawing
The Root Element
Drawing Shapes with SVG Child Elements
Rectangles
Circles
Ellipses
Lines
Compound Shapes
Polygons
Polylines
Styling Shapes with CSS Style Properties
Filling with Gradients
Drawing a Path
Text in SVG
Free-Standing Text
Text Along a Path
Embedding an SVG Drawing in a Web Page
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
7. Using XML Schema
XML Schema Construction Basics
XSD Data Types
XSD Schemas and XML Documents
Working with Simple Types
The String Type
The Boolean Type
Number Types
Date and Time Types
Custom Types
Enumerated Types
List Types
Patterned Types
Digging into Complex Types
Empty Elements
Element-Only Elements
Mixed Elements
Sequences and Choices
Namespaces and XSD Schemas
The xsd Prefix
Referencing Schema Documents
A Complete XML Schema Example
RELAX NG and the Future of XML Schema
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
8. Validating XML Documents
Document Validation Revisited
Validation Tools
DTD Validation
XSD Validation
Validate Document
Repairing Invalid Documents
Check That Document is Well Formed
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
III. Formatting and Displaying XML Documents
9. XML Formatting Strategies
Style Sheets and XML Formatting
The Need for Style Sheets
Getting to Know CSS and XSL
Cascading Style Sheets (CSS)
Extensible Style Language (XSL)
Rendering XML with Style Sheets
Leveraging CSS, XSLT, and XSL-FO
Style Sheets in Action
The CSS Solution
The XSLT Solution
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
10. Styling XML Content with CSS
Getting to Know CSS
A CSS Style Primer
Layout Properties
Formatting Properties
Wiring a Style Sheet to an XML Document
Your First CSS Style Sheet
Inside CSS Positioning
Tinkering with the z-Index
Creating Margins
A Little Padding for Safety
Keeping Things Aligned
The Ins and Outs of Text Formatting
Working with Fonts
Jazzing Up Text with Colors and Image Backgrounds
Tweaking the Spacing of Text
Your Second Complete Style Sheet
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
11. Getting Started with XSL
XSL Basics
The Pieces and Parts of XSL
XSL Transformation
XPath
XSL Formatting Objects
An XSLT Primer
Templates
Patterns and Expressions
Wiring an XSL Style Sheet to an XML Document
Your First XSLT Style Sheet
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
12. Transforming XML with XSLT
A Closer Look at XSLT
Creating and Applying Templates
Processing Nodes
Sorting Nodes
Pattern Essentials
Putting Expressions to Work
Working with Operators
Using Standard Functions
A Complete XSLT Example
Yet Another XSLT Example
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
13. Access Your iTunes Music Library via XML
The Role of XML in iTunes
Digging Into the iTunes Library File
Linking to Tracks in the iTunes Store
Building an iTunes Web Viewer
Revisiting the iTunes XML Music Library
Inside the iTunes Viewer XSLT Stylesheet
Viewing the End Result in a Browser
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
14. Formatting XML with XSL-FO
What Is XSL-FO?
Working with the XSL-FO Language
The Core XSL-FO Document Structure
Styling Text in XSL-FO
Controlling Spacing and Borders
Managing Pages
Validating an XSL-FO Document
Converting an XSL-FO Document to PDF
A More Complete XSL-FO Example
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
15. Using XML to Hack Google Maps
Getting to Know Google Maps
Google Maps Customization Basics
Getting Your Own API Key
Touring the Google Maps API
Obtaining the Geocoordinates of a Location
Brainstorming a Custom Mapping Application
Developing a Custom Map Document
Hacking Together a Custom Google Map
Displaying the Custom Map
Styling a Custom Information Window
Testing Out the Finished Map
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
IV. Processing and Managing XML Data
16. Parsing XML with the DOM
What Is the DOM?
How the DOM Works
Language Bindings
Using the DOM Tree
DOM Interfaces
The Node Interface
The Document Interface
The Element Interface
The Attr Interface
The NodeList Interface
Binding XML Data to a Web Page
Using the DOM to Access XML Data
Loading an XML Document
Traversing the DOM Tree
A Complete DOM Example
Updating the DOM Tree
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
17. SAX: The Simple API for XML
What Is SAX?
A Really Brief History of SAX
SAX 1.0
SAX 2.0
Writing Programs That Use SAX Parsers
Obtaining a SAX Parser
Xerces
libxml
Python
Using SAX with Java
Inside the SAX Sample Program
The main() Method
Implementing the ContentHandler Interface
Implementing the ErrorHandler Interface
Testing the Document Printer Program
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
18. Querying XML Data with XQuery
What Is XQuery?
XML Data Querying 101
Querying with Wildcards
Using Filters to Search for Specific Information
Referencing Attributes
Processing XQuery Results
Getting to Know Saxon
Practical XML Querying with XQuery and Saxon
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
19. Using XML with Databases
A Quick Relational Database Primer
The World’s Shortest Guide to SQL
Retrieving Records Using SELECT
The WHERE Clause
Inserting Records
Updating Records
Deleting Records
Databases and XML
Resolving XML Data into Database Tables
Storing XML Documents in a Database
Exporting an XML Document from a Database
Accessing Data from a Database as XML
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
20. Using XML to Assist Search Engines
Web Crawling Basics
Getting to Know Google Sitemaps
Inside the Google Sitemap Protocol
Creating Your Own Sitemap
A Basic Sitemap Document
Breaking Your Mapping into Multiple Documents
Validating Your Sitemap
Submitting Your Sitemap to Google
Using an Automated Sitemap Tool
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
V. XML’s Impact on HTML
21. Adding Structure to the Web with XHTML
XHTML: A Logical Merger
Comparing XHTML and HTML
Creating and Validating XHTML Documents
Preparing XHTML Documents for Validation
Putting Together an XHTML Document
Validating an XHTML Document
Migrating HTML to XHTML
Hands-on HTML to XHTML Conversion
Automated HTML to XHTML Conversion
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
22. Addressing and Linking XML Documents
Understanding XPath
Navigating a Document with XPath Patterns
Referencing Nodes
Referencing Attributes and Subsets
Using XPath Functions
Node Functions
String Functions
Boolean Functions
Number Functions
The Role of XPath
HTML, XML, and Linking
Addressing with XPointer
Building XPointer Expressions
Creating XPointers
Linking with XLink
Understanding XLink Attributes
Creating Links with XLink
A Complete XLink Example
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
23. Going Wireless with WML and XHTML Mobile
XML and the Wireless Web
WML Essentials
Nuts and Bolts
The WML Root Element
Navigation in WML
Content in WML
Creating WML Documents
Before You Start—Tools of the Trade
Laying Down the Infrastructure
The Basic WML Document
Setting Up Cards
Formatting Text
Four Ways to Navigate
Good Old Anchors
The select>option Setup
Map to OK Button
Associating an Event with a Task
Map to Menu Button
Inserting WBMP Images
Accepting User Input
Blending WML with XHTML Mobile
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
24. Syndicating the Web with RSS News Feeds
A Brief History of RSS
Using an RSS News Aggregator
Inside the RSS 2.0 Language
Creating and Validating a News Feed
Displaying a News Feed
Creating a News Feed Document
Transforming the News Feed for Display
Summary
Q&A
Workshop
Quiz
Quiz Answers
Exercises
VI. Appendix
A. XML Resources
General XML Resources
XML Tools
XML-Based Languages
XML Specifications
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
8. Validating XML Documents
Next
Next Chapter
9. XML Formatting Strategies
Part III. Formatting and Displaying XML Documents
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset