XML Bible (2nd Edition)
Elliotte Rusty Harold, Wiley ISBN:0764547607, Edition: 2, 2001-06-01 Price: $49.99
Table of Contents
Preface ~ vii
Acknowledgments ~ xv
Part I: Introducing XML 1
Chapter 1: An Eagle's Eye View of XML ~ 3
What Is XML? ~ 3
XML is a meta-markup language ~ 3
XML describes structure and semantics, not formatting ~ 5
Why Are Developers Excited About XML? ~ 6
Design of field-specific markup languages ~ 6
Self-describing data ~ 7
Interchange of data among applications ~ 8
Structured and integrated data ~ 8
The Life of an XML Document ~ 9
Editors ~ 9
Parsers and processors ~ 10
Browsers and other applications ~ 10
The process summarized ~ 10
Related Technologies ~ 11
HTML ~ 11
Cascading Style Sheets ~ 12
Extensible Stylesheet Language ~ 12
URLs and URIs ~ 14
XLinks and XPointers ~ 14
The Unicode character set ~ 15
Putting the pieces together ~ 16
Chapter 2: XML Applications ~ 17
XML Applications ~ 17
Chemical Markup Language ~ 18
Mathematical Markup Language ~ 19
Channel Definition Format ~ 22
Classic literature ~ 23
Synchronized Multimedia Integration Language ~ 25
HTML+TIME ~ 25
Open Software Description ~ 27
Scalable Vector Graphics ~ 28
Vector Markup Language ~ 30
MusicML ~ 31
VoiceXML ~ 33
Open Financial Exchange ~ 35
Extensible Forms Description Language ~ 37
HR-XML ~ 41
Resource Description Framework ~ 44
XML for XML ~ 45
XSL ~ 46
XLinks ~ 47
Schemas ~ 47
Behind-the-Scene Uses of XML ~ 48
Microsoft Office 2000 ~ 49
Netscape's What's Related ~ 49
Chapter 3: Your First XML Document ~ 55
Hello XML ~ 55
Creating a simple XML document ~ 56
Saving the XML file ~ 56
Loading the XML file into a Web browser ~ 57
Exploring the Simple XML Document ~ 58
Assigning Meaning to XML Tags ~ 59
Writing a Style Sheet for an XML Document ~ 60
Attaching a Style Sheet to an XML Document ~ 61
Chpater 4: Structuring Data ~ 63
Examining the Data ~ 63
Batters ~ 64
Pitchers ~ 66
Organization of the XML data ~ 69
XMLizing the Data ~ 70
Starting the document: XML declaration and root element ~ 70
XMLizing league, division, and team data ~ 72
XMLizing player data ~ 74
XMLizing player statistics ~ 74
Putting the XML document back together ~ 76
The Advantages of the XML Format ~ 84
Preparing a Style Sheet for Document Display ~ 86
Linking to a style sheet ~ 87
Assigning style rules to the root element ~ 88
Assigning style rules to titles ~ 89
Assigning style rules to player and statistics elements ~ 94
Summing up ~ 95
Chapter 5: Attributes, Empty Tags, and XSL ~ 101
Attributes ~ 101
Attributes versus Elements ~ 107
Structured metadata ~ 107
Meta-metadata ~ 111
What's your metadata is someone else's data ~ 111
Elements are more extensible ~ 112
Good times to use attributes ~ 112
Empty Elements and Empty Element Tags ~ 114
XSL ~ 114
XSLT templates ~ 116
The body of the document ~ 117
The title ~ 119
Leagues, divisions, and teams ~ 122
Players ~ 126
Separation of pitchers and batters ~ 129
Element contents and the select attribute ~ 134
CSS or XSL? ~ 140
Chapter 6: Well-formedness ~ 143
Well-Formedness Rules ~ 144
XML Documents ~ 145
The XML declaration ~ 145
A document must have exactly one root element that completely contains all other elements ~ 146
Text in XML ~ 147
Elements and Tags ~ 148
Element names ~ 148
Every start tag must have a corresponding end tag ~ 149
Empty element tags ~ 149
Elements may nest but may not overlap ~ 151
Attributes ~ 152
Attribute names ~ 153
Attribute values ~ 153
Entity References ~ 154
Comments ~ 156
Processing Instructions ~ 158
CDATA Sections ~ 159
Well-Formed HTML ~ 161
Rules for HTML ~ 161
Tools ~ 170
Chapter 7: Foreign Languages and Non-Roman Text ~ 175
Non-Roman Scripts on the Web ~ 176
Scripts, Character Sets, Fonts, and Glyphs ~ 181
A character set for the script ~ 182
A font for the character set ~ 182
An input method for the character set ~ 182
Operating system and application software ~ 185
Legacy Character Sets ~ 186
The ASCII character set ~ 187
The ISO character sets ~ 189
The MacRoman character set ~ 193
The Windows ANSI character set ~ 194
The Unicode Character Set ~ 195
Unicode Encodings ~ 201
Unicode 3.1 ~ 202
How to Write XML in Unicode ~ 202
Converting to and from Unicode ~ 203
Inserting characters in XML files with character references ~ 204
How to write XML in other character sets ~ 205
Part II: Document Type Definitions 209
Chapter 8: DTDs and Validity ~ 211
Document Type Definitions ~ 211
Element Declarations ~ 212
DTD Files ~ 214
Document Type Declarations ~ 215
Internal DTDs ~ 216
Internal and external DTD subsets ~ 217
Public DTDs ~ 218
DTDs and style sheets ~ 219
Validating Against a DTD ~ 220
Command-line validators ~ 221
Web-based validators ~ 222
Chapter 9: Element Declarations ~ 227
Analyzing the Document ~ 227
The ANY Content Model ~ 233
The #PCDATA Content Model ~ 234
Child Elements ~ 237
Sequences ~ 239
One or More Children ~ 240
Zero or More Children ~ 240
Zero or One Child ~ 241
Grouping with Parentheses ~ 244
Choices ~ 246
Mixed Content ~ 247
Empty Elements ~ 248
Comments in DTDs ~ 249
Chapter 10: Entity Declarations ~ 257
What Is an Entity? ~ 257
Internal General Entities ~ 258
Defining an internal general entity reference ~ 259
Using general entity references in the DTD ~ 262
Predefined general entity references ~ 263
External General Entities ~ 264
Text declarations ~ 266
Nonvalidating parsers ~ 268
Internal Parameter Entities ~ 268
External Parameter Entities ~ 270
Building a Document from Pieces ~ 276
Chapter 11: Attribute Declarations ~ 289
What Is an Attribute? ~ 289
Declaring Attributes in DTDs ~ 290
Declaring Multiple Attributes ~ 291
Specifying Default Values for Attributes ~ 292
#REQUIRED ~ 292
#IMPLIED ~ 293
#FIXED ~ 294
Attribute Types ~ 294
The CDATA attribute type ~ 295
The NMTOKEN attribute type ~ 295
The NMTOKENS attribute type ~ 296
The enumerated attribute type ~ 296
The ID attribute type ~ 297
The IDREF attribute type ~ 298
The IDREFS attribute type ~ 299
The ENTITY attribute type ~ 300
The ENTITIES attribute type ~ 300
The NOTATION attribute type ~ 301
Predefined Attributes ~ 301
xml:space ~ 302
xml:lang ~ 303
Declarations of xml:lang ~ 308
A DTD for Attribute-Based Baseball Statistics ~ 308
Declaring SEASON attributes in the DTD ~ 310
Declaring LEAGUE and DIVISION attributes in the DTD ~ 310
Declaring TEAM attributes in the DTD ~ 311
Declaring PLAYER attributes in the DTD ~ 311
The complete DTD for the baseball statistics example ~ 314
Chapter 12: Unparsed Entities, Notations, and Non-XML Data ~ 317
Notations ~ 318
Unparsed Entities ~ 321
Declaring unparsed entities ~ 321
Embedding unparsed entities ~ 322
Embedding multiple unparsed entities ~ 325
Processing Instructions ~ 325
Conditional Sections in DTDs ~ 329
Chapter 13: Namespaces ~ 331
The Need for Namespaces ~ 331
Namespace Syntax ~ 333
Defining namespaces with xmlns attributes ~ 336
Multiple namespaces ~ 339
Attributes ~ 343
Default namespaces ~ 344
Namespaces and Validity ~ 349
Part III: Style Languages 351
Chapter 14: CSS Style Sheets ~ 353
What Are Cascading Style Sheets? ~ 353
A simple CSS style sheet ~ 354
Attaching style sheets to documents ~ 354
Document Type Definitions and style sheets ~ 357
CSS1 versus CSS2 ~ 358
CSS3 ~ 358
Comments in CSS ~ 359
Selecting Elements ~ 360
The universal selector ~ 362
Grouping selectors ~ 363
Hierarchy selectors ~ 364
Attribute selectors ~ 366
ID selectors ~ 366
Pseudo-elements ~ 367
Pseudo-classes ~ 369
Inheritance ~ 371
Cascades ~ 372
Different Rules for Different Media ~ 374
Importing Style Sheets ~ 375
Style Sheet Character Sets ~ 376
Chapter 15: CSS Layouts ~ 379
CSS Units ~ 380
Length values ~ 381
URL values ~ 383
Color values ~ 384
Keyword values ~ 388
Strings ~ 388
The Display Property ~ 388
Inline elements ~ 393
Block elements ~ 393
None ~ 393
Compact and run-in elements ~ 394
Marker ~ 395
Tables ~ 395
List items ~ 397
Box Properties ~ 400
Margin properties ~ 400
Border properties ~ 403
Outline properties ~ 406
Padding properties ~ 409
Size ~ 410
The width and height properties ~ 410
The min-width and min-height properties ~ 412
The max-width and max-height properties ~ 413
The overflow property ~ 413
Clipping ~ 414
Positioning ~ 415
The position property ~ 415
Stacking elements with the z-index property ~ 419
The float property ~ 420
The clear property ~ 421
Formatting Pages ~ 422
@page ~ 422
The size property ~ 422
The margin property ~ 423
The mark property ~ 423
The page property ~ 423
Controlling page breaks ~ 424
Widows and orphans ~ 425
Chapter 16: CSS Text Styles ~ 427
Font Properties ~ 427
Choosing the font family ~ 428
Choosing the font style ~ 430
Small caps ~ 431
Setting the font weight ~ 431
Setting the font size ~ 432
The font shorthand property ~ 438
The Color Property ~ 439
Text Properties ~ 440
Word spacing ~ 441
The letter-spacing property ~ 441
The text-decoration property ~ 443
The vertical-align property ~ 444
The text-transform property ~ 445
The text-align property ~ 445
The text-indent property ~ 446
The text-shadow property ~ 446
The line-height property ~ 448
The white-space property ~ 449
Background Properties ~ 451
The background-color property ~ 452
The background-image property ~ 452
The background-repeat property ~ 454
The background-attachment property ~ 457
The background-position property ~ 458
The background shorthand property ~ 462
Visibility ~ 463
Cursors ~ 464
The Content Property ~ 465
Quotes ~ 466
Attributes ~ 467
URIs ~ 467
Counters ~ 468
Aural Style Sheets ~ 472
The speak property ~ 473
The volume property ~ 473
Pause properties ~ 474
Cue properties ~ 474
Play-during property ~ 474
Spatial properties ~ 475
Voice characteristics ~ 476
Speech properties ~ 478
Chapter 17: XSL Transformations ~ 481
What Is XSL? ~ 481
Overview of XSL Transformations ~ 482
Trees ~ 483
XSLT style sheet documents ~ 486
Where does the XML transformation happen? ~ 488
How to use Xalan ~ 488
Direct display of XML files with XSLT style sheets ~ 491
XSL Templates ~ 493
The xsl:apply-templates element ~ 494
The select attribute ~ 496
Computing the Value of a Node with xsl:value-of ~ 497
Processing Multiple Elements with xsl:for-each ~ 499
Patterns for Matching Nodes ~ 499
Matching the root node ~ 500
Matching element names ~ 501
Wild cards ~ 502
Matching children with / ~ 504
Matching descendants with // ~ 505
Matching by ID ~ 505
Matching attributes with @ ~ 506
Matching comments with comment( ) ~ 508
Matching processing instructions with processing-instruction( ) ~ 509
Matching text nodes with text( ) ~ 510
Using the or operator | ~ 510
Testing with [ ] ~ 511
XPath Expressions for Selecting Nodes ~ 513
Node axes ~ 514
Expression types ~ 520
The Default Template Rules ~ 531
The default rule for elements ~ 531
The default rule for text nodes and attributes ~ 532
The default rule for processing instructions and comments ~ 532
Implications of the default rules ~ 532
Deciding What Output to Include ~ 533
Attribute value templates ~ 533
Inserting elements into the output with xsl:element ~ 535
Inserting attributes into the output with xsl:attribute ~ 536
Defining attribute sets ~ 537
Generating processing instructions with xsl:processing-instruction 538
Generating comments with xsl:comment ~ 539
Generating text with xsl:text ~ 539
Copying the Context Node with xsl:copy ~ 540
Counting Nodes with xsl:number ~ 542
Default numbers ~ 543
Number to string conversion ~ 547
Sorting Output Elements ~ 548
Modes ~ 551
Defining Constants with xsl:variable ~ 553
Named Templates ~ 555
Passing Parameters to Templates ~ 556
Stripping and Preserving White Space ~ 557
Making Choices ~ 559
xsl:if ~ 559
xsl:choose ~ 559
Merging Multiple Style Sheets ~ 560
Importing with xsl:import ~ 560
Inclusion with xsl:include ~ 561
Embedding with xsl:stylesheet ~ 561
Output Methods ~ 563
xsl:output ~ 563
XML Declaration ~ 564
Document type declaration ~ 565
Indentation ~ 566
CDATA sections ~ 567
Media type ~ 567
Chapter 18: XSL Formatting Objects ~ 571
Formatting Objects and Their Properties ~ 571
Formatting properties ~ 574
Transforming to formatting objects ~ 579
Using FOP ~ 581
Page Layout ~ 583
The root element ~ 583
Simple page masters ~ 584
Page sequences ~ 587
Page sequence masters ~ 596
Content ~ 599
Block-level formatting objects ~ 599
Inline formatting objects ~ 600
Table formatting objects ~ 601
Out-of-line formatting objects ~ 601
Leaders and Rules ~ 602
Graphics ~ 604
fo:external-graphic ~ 604
fo:instream-foreign-object ~ 607
Graphic properties ~ 609
Links ~ 611
Lists ~ 612
Tables ~ 616
Inlines ~ 622
Footnotes ~ 623
Floats ~ 623
Formatting Properties ~ 624
The id property ~ 625
The language property ~ 625
Paragraph properties ~ 625
Character properties ~ 628
Sentence properties ~ 631
Area properties ~ 633
Aural properties ~ 640
Part IV: Supplemental Technologies 645
Chapter 19: XLinks ~ 647
XLinks versus HTML Links ~ 647
Linking Elements ~ 648
Declaring XLink attributes in document type definitions ~ 650
Descriptions of the Remote Resource ~ 652
Link Behavior ~ 653
The xlink:show attribute ~ 653
The xlink:actuate attribute ~ 655
Extended Links ~ 657
Extended Link Syntax ~ 658
Arcs ~ 661
Out-of-Line Links ~ 669
Chapter 20: XPointers ~ 677
Why Use XPointers? ~ 677
XPointer Examples ~ 678
A Concrete Example ~ 681
Location Paths, Steps, and Sets ~ 684
The Root Node ~ 686
Axes ~ 686
The child axis ~ 687
The descendant axis ~ 688
The descendant-or-self axis ~ 689
The parent axis ~ 689
The self axis ~ 689
The ancestor axis ~ 689
The ancestor-or-self axis ~ 689
The preceding axis ~ 690
The following axis ~ 690
The preceding-sibling axis ~ 690
The following-sibling axis ~ 690
The attribute axis ~ 691
The namespace axis ~ 691
Node Tests ~ 692
Predicates ~ 694
Functions that Return Node Sets ~ 697
id( ) ~ 697
here( ) ~ 698
origin( ) ~ 699
Points ~ 700
Ranges ~ 701
Range functions ~ 702
String ranges ~ 702
Child Sequences ~ 704
Chapter 21: The Resource Description Framework ~ 707
What Is RDF? ~ 707
RDF Statements ~ 708
Basic RDF Syntax ~ 710
The RDF Root Element ~ 710
The Description element ~ 710
Namespaces ~ 711
Multiple properties and statements ~ 713
Resource valued properties ~ 715
XML valued properties ~ 718
Abbreviated RDF syntax ~ 718
Containers ~ 719
The Bag container ~ 720
The Seq container ~ 722
The Alt container ~ 723
Statements about containers ~ 724
Statements about container members ~ 727
Statements about implied bags ~ 729
RDF Schemas ~ 729
Part V: XML Applications 733
Chapter 22: XHTML ~ 735
Why Validate HTML? ~ 735
Moving to XHTML ~ 737
Making the document well-formed XML ~ 740
Making the document valid ~ 747
The strict DTD ~ 755
The frameset DTD ~ 768
HTML Tidy ~ 769
What's New in XHTML ~ 773
Character references ~ 773
Custom entity references defined in DTD ~ 777
Encoding declarations ~ 780
The xml:lang attribute ~ 781
CDATA sections ~ 782
Chapter 23: The Wireless Markup Language ~ 787
What Is WML? ~ 788
Hello WML ~ 788
The WML MIME media type ~ 789
Browsing the Web from your phone ~ 790
Cell phone simulators ~ 791
Basic Text Markup ~ 794
Tables ~ 796
Images ~ 798
Entity references ~ 799
Cards and Links ~ 800
Multicard decks ~ 800
The do element ~ 801
Anchors ~ 804
Selections ~ 807
The Options Menu ~ 809
Templates ~ 810
Events ~ 811
The Header ~ 814
The access element ~ 814
Meta ~ 815
Variables ~ 816
Reading and writing variables ~ 816
Input fields ~ 819
Select ~ 821
Setting a new context for variables ~ 821
Talking Back to the Server ~ 822
Chapter 24: Schemas ~ 827
What's Wrong with DTDs? ~ 827
What is a Schema? ~ 829
The W3C XML Schema Language ~ 831
Hello Schemas ~ 832
The greeting schema ~ 832
Validating the document against the schema ~ 834
Complex Types ~ 836
minOccurs and maxOccurs ~ 838
Element content ~ 841
Sharing content models ~ 843
Anonymous types ~ 844
Mixed content ~ 846
Grouping ~ 848
The xsd:all Group ~ 849
Choices ~ 850
Sequences ~ 851
Simple Types ~ 851
Numeric data types ~ 854
Time data types ~ 856
XML data types ~ 857
String data types ~ 858
Miscellaneous data types ~ 859
Derived Types ~ 859
Regular expressions ~ 860
The xsd:simpleType element ~ 865
Empty Elements ~ 867
Attributes ~ 867
Namespaces ~ 871
Schemas for default namespaces ~ 871
Multiple namespaces, multiple schemas ~ 875
Annotations ~ 878
Chapter 25: Scalable Vector Graphics ~ 881
What Is SVG? ~ 882
Scalability ~ 883
Vector versus bitmapped graphics ~ 884
A Simple SVG Document ~ 885
Embedding SVG Pictures in Web Pages ~ 888
Simple Shapes ~ 891
The rect element ~ 891
The circle element ~ 894
The ellipse element ~ 895
The line element ~ 896
Polygons and polylines ~ 898
Paths ~ 899
Arcs ~ 902
Curves ~ 905
Text ~ 907
Strings ~ 907
Text on a path ~ 909
Fonts and text styles ~ 911
Text spans ~ 912
Bitmapped Images ~ 913
Coordinate Systems and Viewports ~ 914
The viewport ~ 915
Coordinate systems ~ 917
Grouping Shapes ~ 921
Referencing Shapes ~ 922
Transformations ~ 924
Linking ~ 932
Metadata ~ 933
SVG Editors ~ 936
Chapter 26: The Vector Markup Language ~ 939
What Is VML? ~ 939
Drawing with a Keyboard ~ 941
The shape element ~ 942
Other shape attributes ~ 944
Shape child elements ~ 945
Predefined shapes ~ 946
The shapetype element ~ 947
The group element ~ 949
Positioning VML Shapes with CSS Properties ~ 950
The rotation property ~ 953
The flip property ~ 955
The center-x and center-y properties ~ 956
VML in Microsoft Office ~ 956
Settings ~ 957
Drawing a house ~ 958
Chapter 27: The Channel Definition Format ~ 965
What Is the Channel Definition Format? ~ 965
Creating Channels ~ 966
Determining channel content ~ 966
Creating CDF files and documents ~ 967
Linking the Web page to the channel ~ 968
Describing the Channel ~ 970
Title ~ 970
Abstract ~ 972
Logos ~ 973
Scheduling Updates ~ 975
Precaching and Web Crawling ~ 978
Precaching ~ 978
Web crawling ~ 978
The Reader Access Log ~ 979
The BASE Attribute ~ 981
The LASTMOD Attribute ~ 982
The USAGE Element ~ 984
Desktop components ~ 985
E-mail ~ 986
Precaching ~ 987
Screen savers ~ 988
Software update ~ 990
Chapter 28: Designing a New XML Application ~ 995
Organization of the Data ~ 995
Listing the elements ~ 997
Identifying the fundamental elements ~ 998
Establishing relationships among the elements ~ 1000
The Person DTD ~ 1002
The Family DTD ~ 1007
The Source DTD ~ 1009
The Family Tree DTD ~ 1010
Designing a Style Sheet for Family Trees ~ 1017
Appendix A: What's on the CD-ROM ~ 1025
Appendix B: XML Reference Material ~ 1029
Appendix C: The XML 1.0 Specification, Second Edition ~ 1089
Index ~ 1153
End-User Licence Agreement ~ 1212
CD-ROM Installation Instructions ~ 1214
|