XML: Visual QuickStart Guide [2nd ed]
9780321559678, 0321559673
What is XML? XML, or eXtensible Markup Language, is a specification for storing information. It is also a specification
261
67
4MB
English
Pages 269
[289]
Year 2009;2011
Report DMCA / Copyright
DOWNLOAD PDF FILE
Table of contents :
Cover......Page 1
Table of Contents......Page 6
Introduction......Page 12
What is XML?......Page 13
The Power of XML......Page 14
Extending XML......Page 15
XML in Practice......Page 16
About This Book......Page 17
What This Book is Not......Page 19
Part 1: XML......Page 20
Chapter 1: Wrinting XML......Page 22
An XML Sample......Page 23
Rules for Writing XML......Page 24
Elements, Attributes, and Values......Page 25
How To Begin......Page 26
Creating the Root Element......Page 27
Writing Child Elements......Page 28
Nesting Elements......Page 29
Adding Attributes......Page 30
Using Empty Elements......Page 31
Writing Comments......Page 32
Predefined Entities – Five Special Symbols......Page 33
Displaying Elements as Text......Page 34
Part 2: XSL......Page 36
Chapter 2: XSLT......Page 38
Transforming XML with XSLT......Page 39
Beginning an XSLT Style Sheet......Page 41
Creating the Root Template......Page 42
Outputting HTML......Page 43
Outputting Values......Page 45
Looping Over Nodes......Page 47
Processing Nodes Conditionally......Page 49
Adding Conditional Choices......Page 50
Sorting Nodes Before Processing......Page 51
Generating Output Attributes......Page 52
Creating and Applying Templates......Page 53
Chapter 3: XPath Patterns and Expressions......Page 56
Locating Nodes......Page 57
Determining the Current Node......Page 59
Referring to the Current Node......Page 60
Selecting a Node’s Children......Page 61
Selecting a Node’s Parent or Siblings......Page 62
Selecting a Node’s Attributes......Page 63
Conditionally Selecting Nodes......Page 64
Creating Absolute Location Paths......Page 65
Selecting All the Descendants......Page 66
Chapter 4: XPath Functions......Page 68
Comparing Two Values......Page 69
Testing the Position......Page 70
Multiplying, Dividing, Adding, Subtracting......Page 71
Counting Nodes......Page 72
Formatting Numbers......Page 73
Rounding Numbers......Page 74
Extracting Substrings......Page 75
Changing the Case of a String......Page 76
Totaling Values......Page 77
More XPath Functions......Page 78
Chapter 5: XSL-FO......Page 80
The Two Parts of an XSL-FO Document......Page 81
Creating an XSL-FO Document......Page 82
Creating and Styling Blocks of Page Content......Page 83
Adding Images......Page 84
Defining a Page Template......Page 85
Creating a Page Template Header......Page 86
Using XSLT to Create XSL-FO......Page 87
Inserting Page Breaks......Page 88
Outputting Page Content in Columns......Page 89
Adding a New Page Template......Page 90
Part 3: DTD......Page 92
Chapter 6: Creating a DTD......Page 94
Working with DTDs......Page 95
Defining an Element That Contains Text......Page 96
Defining an Empty Element......Page 97
Defining an Element That Contains a Child......Page 98
Defining an Element That Contains Children......Page 99
Defining How Many Occurrences......Page 100
Defining Choices......Page 101
Defining an Element That Contains Anything......Page 102
About Attributes......Page 103
Defining Attributes......Page 104
Defining Default Values......Page 105
Defining Attributes with Choices......Page 106
Defining Attributes with Unique Values......Page 107
Referencing Attributes with Unique Values......Page 108
Restricting Attributes to Valid XML Names......Page 109
Chapter 7: Entities and Notations in DTDs......Page 110
Creating a General Entity......Page 111
Using General Entities......Page 112
Creating an External General Entity......Page 113
Using External General Entities......Page 114
Creating Entities for Unparsed Content......Page 115
Embedding Unparsed Content......Page 117
Creating and Using Parameter Entities......Page 119
Creating an External Parameter Entity......Page 120
Chapter 8: Validation and Using DTDs......Page 122
Creating an External DTD......Page 123
Declaring an External DTD......Page 124
Declaring and Creating an Internal DTD......Page 125
Validating XML Documents Against a DTD......Page 126
Naming a Public External DTD......Page 127
Declaring a Public External DTD......Page 128
Pros and Cons of DTDs......Page 129
Part 4: XML Schema......Page 130
Chapter 9: XML Schema Basics......Page 132
Working with XML Schema......Page 133
Beginning a Simple XML Schema......Page 135
Associating an XML Schema with an XML Document......Page 136
Annotating Schemas......Page 137
Chapter 10: Defining Simple Types......Page 138
Defining a Simple Type Element......Page 139
Using Date and Time Types......Page 141
Using Number Types......Page 143
Predefining an Element’s Content......Page 144
Deriving Custom Simple Types......Page 145
Deriving Named Custom Types......Page 146
Specifying a Range of Acceptable Values......Page 147
Specifying a Set of Acceptable Values......Page 149
Limiting the Length of an Element......Page 150
Specifying a Pattern for an Element......Page 151
Limiting a Number’s Digits......Page 153
Deriving a List Type......Page 154
Deriving a Union Type......Page 155
Chapter 11: Defining Complex Types......Page 156
Complex Type Basics......Page 157
Deriving Anonymous Complex Types......Page 159
Deriving Named Complex Types......Page 160
Defining Complex Types That Contain Child Elements......Page 161
Requiring Child Elements to Appear in Sequence......Page 162
Allowing Child Elements to Appear in Any Order......Page 163
Creating a Set of Choices......Page 164
Defining Elements to Contain Only Text......Page 165
Defining Empty Elements......Page 166
Defining Elements with Mixed Content......Page 167
Deriving Complex Types from Existing Complex Types......Page 168
Referencing Globally Defined Elements......Page 169
Controlling How Many......Page 170
Defining Named Model Groups......Page 171
Referencing a Named Model Group......Page 172
Defining Attributes......Page 173
Requiring an Attribute......Page 174
Predefining an Attribute’s Content......Page 175
Defining Attribute Groups......Page 176
Referencing Attribute Groups......Page 177
Local and Global Definitions......Page 178
Part 5: Namespaces......Page 180
Chapter 12: XML Namespaces......Page 182
Designing a Namespace Name......Page 183
Declaring a Default Namespace......Page 184
Declaring a Namespace Name Prefix......Page 185
Labeling Elements with a Namespace Prefix......Page 186
How Namespaces Affect Attributes......Page 187
Chapter 13: Using XML Namespaces......Page 188
Populating an XML Namespace......Page 189
XML Schemas, XML Documents, and Namespaces......Page 190
Referencing XML Schema Components in Namespaces......Page 191
Namespaces and Validating XML......Page 192
Adding All Locally Defined Elements......Page 193
Adding Particular Locally Defined Elements......Page 194
XML Schemas in Multiple Files......Page 195
XML Schemas with Multiple Namespaces......Page 196
The Schema of Schemas as the Default......Page 197
Namespaces and DTDs......Page 198
XSLT and Namespaces......Page 199
Part 6: Recent W3C Recommendations......Page 200
Chapter 14: XSLT 2.0......Page 202
Extending XSLT......Page 203
Creating a Simplified Style Sheet......Page 204
Generating XHTML Output Documents......Page 205
Generating Multiple Output Documents......Page 206
Creating User Defined Functions......Page 207
Calling User Defined Functions......Page 208
Grouping Output Using Common Values......Page 209
Validating XSLT Output......Page 210
Chapter 15: XPath 2.0......Page 212
XPath 1.0 and XPath 2.0......Page 213
Averaging Values in a Sequence......Page 215
Finding the Minimum or Maximum Value......Page 216
Formatting Strings......Page 217
Testing Conditions......Page 218
Quantifying a Condition......Page 219
Removing Duplicate Items......Page 220
Looping Over Sequences......Page 221
Using Today’s Date and Time......Page 222
Writing Comments......Page 223
Processing Non-XML Input......Page 224
Chapter 16: XQuery 1.0......Page 226
XQuery 1.0 vs. XSLT 2.0......Page 227
Composing an XQuery Document......Page 228
Identifying an XML Source Document......Page 229
Using Path Expressions......Page 230
Writing FLWOR Expressions......Page 231
Testing with Conditional Expressions......Page 233
Joining Two Related Data Sources......Page 234
Creating and Calling User Defined Functions......Page 235
XQuery and Databases......Page 236
Part 7: XML in Practice......Page 238
Chapter 17: Ajax, RSS, SOAP, and More......Page 240
Ajax Basics......Page 241
Ajax Examples......Page 243
RSS Basics......Page 245
RSS Schema......Page 246
Extending RSS......Page 247
SOAP and Web Services......Page 249
SOAP Message Schema......Page 250
WSDL......Page 251
KML Basics......Page 253
A Simple KML File......Page 254
ODF and OOXML......Page 255
eBooks, ePub, and More......Page 257
Tools for XML in Practice......Page 259
Appendices......Page 262
Appendix A: XML Tools......Page 264
XML Editors......Page 265
Additional XML Editors......Page 267
XML Tools and Resources......Page 268
Appendix B: Character Sets and Entities......Page 270
Specifying the Character Encoding......Page 271
Using Numeric Character References......Page 272
Using Entity References......Page 273
Unicode Characters......Page 274
A......Page 276
B......Page 277
D......Page 278
E......Page 279
F......Page 280
L......Page 281
O......Page 282
R......Page 283
T......Page 284
W......Page 285
X......Page 286
Z......Page 288