XML is a powerful cross-platform mark-up language which has readily been adopted as a standard in many spheres of web and software development. Real benefits include its ease of integration into existing systems, the simplicity of using it in object-oriented environments and its wide applicability. Chris Bates shows how to use XML in modern software developments and backs up a thorough treatment of its key points with clear, practical examples.Programmers and developers wanting both A-Z coverage and a practical how-to, will find stepwise guidance on:creating data,storage formats,implementing interfaces,providing a wireless protocol in distributed applications (SOAP), andcreating intermediate data formats on the web.Chris Bates provides live code in Java to show how XML can be employed in the development of applications and also provides details of how XML parsers work. You will learn more than simply how XML operates. You'll gain insight and understanding of the concepts, their importance and their application. Problems and exercises are provided and make the book ideal for self-study or classroom situations. With an accompanying website containing code samples and links to important web-sites, XML in Theory and Practice is a must-have primer on the subject. Accompanying website: homepages.shu.ac.uk/~cmscrb/XML/
Author(s): Chris Bates
Edition: 1
Year: 2003
Language: English
Pages: 482
XML in Theory and Practice......Page 4
Copyright......Page 5
Contents......Page 6
Preface......Page 11
1 Introduction......Page 14
Part I Extensible Markup Language......Page 24
2 Writing XML......Page 26
2.1 A FIRST EXAMPLE......Page 27
2.2 WHY NOT USE HTML?......Page 28
2.3.1 XML Tags......Page 31
2.3.2 Attributes......Page 35
2.3.4 Entities......Page 37
2.3.5 Processing Instructions......Page 39
2.3.6 Formally Defining XML Structures......Page 40
2.4 PARSING XML FILES......Page 42
2.4.2 Unparsed Character Data......Page 43
2.4.3 Whitespace......Page 44
2.5 THE RECIPE BOOK......Page 47
2.6 THE BUSINESS LETTER......Page 51
Exercises......Page 54
3 Document Type Definitions......Page 56
3.1 STRUCTURE......Page 57
3.2 ELEMENTS......Page 58
3.2.1 Sequence and Selection......Page 59
3.3 ATTRIBUTES......Page 60
3.4 ENTITIES......Page 61
3.5 NOTATIONS......Page 64
3.6.1 External DTDs......Page 65
3.6.2 Customizing DTDs......Page 66
3.7 THE RECIPE BOOK......Page 67
3.8 BUSINESS LETTER......Page 70
Exercises......Page 72
4 Specifying XML Structures Using Schema......Page 74
4.1 NAMESPACES......Page 76
4.1.1 Declaring Namespaces......Page 77
4.1.2 Applying Namespaces......Page 78
4.2 USING SCHEMAS......Page 79
4.2.1 Validating Schemas......Page 82
4.3.1 Simple Types......Page 84
4.3.2 Complex Types......Page 86
4.4 DATA IN SCHEMA......Page 91
4.4.1 Regular Expression Language......Page 93
4.5.1 Sequence......Page 95
4.5.2 All......Page 96
4.5.4 Restriction......Page 97
4.5.6 Union......Page 102
4.6 EXAMPLE SCHEMA......Page 103
4.6.1 The Business Letter Schema......Page 104
Exercises......Page 111
Part II Formatting XML for Display and Print......Page 114
5 Cascading Style Sheets......Page 116
5.1 CSS AND HTML......Page 117
5.1.1 Using Styles: Simple Examples......Page 118
5.2 CSS AND XML......Page 121
5.3.2 Rules......Page 123
5.3.3 Classes......Page 124
5.4.1 Formatting Elements......Page 126
5.4.2 Fonts......Page 127
5.4.4 Text......Page 129
5.4.5 Boxes......Page 130
5.4.6 Units, URLs and Colors......Page 131
5.5 A STYLESHEET FOR THE BUSINESS LETTER......Page 132
Exercises......Page 135
6 Cascading Style Sheets Two......Page 136
6.1 THE DESIGN OF CSS2......Page 137
6.1.1 Media Types......Page 138
6.2 STYLING FOR PAGED MEDIA......Page 139
6.2.1 Page Rules......Page 140
6.3.1 Properties......Page 143
6.4 COUNTERS AND NUMBERING......Page 147
6.4.1 Counters......Page 149
Exercises......Page 151
7 Navigating within and between XML Documents......Page 152
7.1 XPATH......Page 153
7.1.1 Introducing XPath Constructs......Page 154
7.1.2 Location Paths......Page 156
7.1.3 Function Library......Page 162
7.1.4 Data Types......Page 165
7.2 XLINK......Page 167
7.2.1 An XLink Scenario......Page 168
7.2.2 XLink Attributes......Page 170
7.2.3 Simple Links......Page 173
7.2.4 Extended Links......Page 175
7.2.5 Linkbases and Generic Links......Page 177
7.3 XPOINTER......Page 179
8 XSL Transformation Language......Page 182
8.1 INTRODUCING XSLT......Page 183
8.1.1 Why Use XSLT?......Page 184
8.1.2 An Example Transformation......Page 185
8.2 STARTING THE STYLESHEET......Page 187
8.3 TEMPLATES......Page 188
8.4 XSL ELEMENTS......Page 190
8.5 .XSL FUNCTIONS......Page 192
8.6 USING VARIABLES......Page 195
8.7 PARAMETER PASSING......Page 197
8.8 MODES......Page 199
8.9 HANDLING WHITESPACE......Page 200
Exercises......Page 209
9 XSLT in Use......Page 210
9.1.1 Selecting a Recipe......Page 211
9.1.2 Displaying a Recipe......Page 216
9.2 THE BUSINESS LETTER......Page 221
10 XSL Formatting Objects......Page 232
10.1.1 Structuring a Report......Page 234
10.1.2 Structuring a Book......Page 235
10.1.3 Page Structure......Page 236
10.2 PROCESSING XSL-FO......Page 237
10.3 FORMATTING OBJECT ELEMENTS......Page 240
10.3.1 Blocks......Page 247
10.3.2 XSL- FO Properties......Page 251
10.3.4 Footnotes......Page 254
10.3.5 Tables......Page 256
10.3.6 Lists......Page 259
10.3.7 Images......Page 261
10.3.8 Floats......Page 262
10.4 THE RECIPE BOOK......Page 263
Part III Handling XML in Your Own Programs......Page 274
11 Java and XML......Page 276
11.1.1 Java API for XML Processing......Page 280
11.1.3 Xalan- Java......Page 282
11.1.5 FOP......Page 283
12 The Document Object Model......Page 288
12.1.1 What is the DOM......Page 289
12.1.3 DOM Nodes......Page 290
12.2 THE XERCES DOM API......Page 292
12.2.1 Fields......Page 293
12.2.2 Methods......Page 294
12.3 USING THE DOM TO COUNT NODES......Page 296
12.4 USING THE DOM TO DISPLAY A DOCUMENT......Page 299
13 The Simple API for XML......Page 302
13.1 THE SAX API......Page 304
13.1.1 org. xml. sax......Page 305
13.1.2 org. xml. sax. helpers......Page 310
13.2.1 Using Xerces......Page 312
13.2.2 Using Crimson......Page 316
Exercises......Page 318
Part IV Some Real-World Applications of XML......Page 320
14 Introducing XHTML......Page 322
14.1 XHTML DOCUMENT TYPE DEFINITIONS......Page 324
14.2 AN XHTML PRIMER......Page 325
14.2.2 Text Formatting......Page 326
14.2.3 Hyperlinks......Page 329
14.2.4 Lists......Page 330
14.2.5 Tables......Page 333
14.3 THE RULES OF XHTML......Page 338
14.3.1 Validation......Page 339
Exercises......Page 340
15 Web Services - The Future of the Web?......Page 342
15.1 SOME TYPICAL SCENARIOS......Page 343
15.1.1 The Evening Meal......Page 344
15.1.2 Ordering Goods and Services......Page 345
15.2 SEMANTIC WEB......Page 346
15.3 RESOURCE DESCRIPTION FRAMEWORK......Page 348
15.3.1 Representing RDF Statements in XML......Page 350
15.4 WEB SERVICES......Page 353
15.4.1 Web Services Description Language......Page 355
15.4.2 Universal Description, Discovery and Integration......Page 359
Exercises......Page 362
16 Distributed Applications with SOAP......Page 364
16.1 AN OVERVIEW OF SOAP......Page 365
16.1.1 The Structure of a SOAP Packet......Page 367
16.1.2 Using SOAP......Page 369
16.1.3 SOAP Faults......Page 372
16.1.4 Data Types in SOAP......Page 374
16.2.1 Installing Apache SOAP and Tomcat......Page 375
16.2.2 Hello World......Page 380
16.3 ACCESSING RECIPES......Page 385
17 DocBook......Page 394
17.1 INTRODUCING DOCBOOK......Page 395
17.2 CREATING DOCBOOK DOCUMENTS......Page 396
17.2.1 A Simple Article......Page 397
17.2.3 Parsing and Validation......Page 406
17.3 STYLING DOCBOOK DOCUMENTS USING DSSSL......Page 408
17.3.1 Using Jade......Page 409
17.3.2 DSSSL Stylesheets......Page 410
17.4 STYLING DOCBOOK DOCUMENTS USING XSL......Page 412
Exercises......Page 413
18 XUL......Page 416
18.1 INTRODUCING XUL......Page 417
18.2.1 Creating Windows......Page 420
18.2.2 Text and Images......Page 422
18.2.3 Buttons......Page 424
18.2.4 Text Widgets......Page 426
18.2.5 Layout......Page 428
18.2.6 Adding Behavior......Page 429
18.3 USING XUL......Page 430
Exercises......Page 433
References......Page 434
Appendix A Business Letter in XML......Page 438
Appendix B Recipe Book in XML......Page 442
Index......Page 474