9781118162132

Beginning XML, 5th Edition

by ; ;
  • ISBN13:

    9781118162132

  • ISBN10:

    1118162137

  • Edition: 5th
  • Format: Paperback
  • Copyright: 7/10/2012
  • Publisher: Wrox

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $59!
    Your order must be $59 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
  • We Buy This Book Back!
    In-Store Credit: $6.30
    Check/Direct Deposit: $6.00
List Price: $39.99 Save up to $15.04
  • Rent Book $35.99
    Add to Cart Free Shipping

    TERM
    PRICE
    DUE

Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Summary

A complete update covering the many advances to the XML language The XML language has become the standard for writing documents on the Internet and is constantly improving and evolving. This new edition covers all the many new XML-based technologies that have appeared since the previous edition four years ago, providing you with an up-to-date introductory guide and reference. Packed with real-world code examples, best practices, and in-depth coverage of the most important and relevant topics, this authoritative resource explores both the advantages and disadvantages of XML and addresses the most current standards and uses of XML. Features the most updated content built on audience feedback from the previous edition as well as the vast knowledge from XML developer teams Boasts new chapters on schematron, XML functionality in Oracle, LINQ, Jabber and XMLPP, XHTML, HTML5, and more Offers in-depth coverage on extracting data from XML and updated material on Web Services Beginning XML, Fifth Edition delivers the most important aspects of XML in regard to what it is, how it works, what technologies surround it, and how it can best be used in a variety of situations.

Author Biography

Joe Fawcett is the head of software at Kaplan Financial and was one of the first Microsoft MVPs for XML.

Liam R. E. Quin is the W3C XML Activity Lead and Staff Contact for the XML Query Working Group, and the XSL-FO subgroup of the XSL Working Group.

Danny Ayers works for Talis on applications for their hosted semantic web platform.

Table of Contents

INTRODUCTION XXVII

PART I: INTRODUCING XML

CHAPTER 1: WHAT IS XML? 3

Steps Leading up to XML: Data Representation and Markups 4

Binary Files 4

Text Files 5

A Brief History of Markup 6

The Birth of XML 6

More Advantages of XML 10

XML Rules 10

Hierarchical Data Representation 11

Interoperability 12

XML in Practice 13

Data Versus Document 13

XML Scenarios 14

XML Technologies 16

Summary 23

CHAPTER 2: WELL-FORMED XML 25

What Does Well-Formed Mean? 26

Creating XML in a Text Editor 26

Forbidden Characters 26

XML Prolog 27

Creating Elements 30

Attributes 33

Element and Attribute Content 34

Processing Instructions 38

CDATA Sections 39

Advanced XML Parsing 40

XML Equivalence 41

Whitespace Handling 42

Error Handling 44

The XML Infoset 47

The Document Information Item 48

Element Information Items 48

Attribute Information Items 48

Processing Instruction Information Items 48

Character Information Item 49

Comment Information Item 49

Namespace Information Item 49

The Document Type Declaration Information Item 49

Unexpanded Entity Reference Information Item 49

Unparsed Entity Information Item 49

Notation Information Item 49

Summary 50

CHAPTER 3: XML NAMESPACES 53

Defi ning Namespaces 54

Why Do You Need Namespaces? 54

How Do You Choose a Namespace? 56

URLs, URIs, and URNs 56

Creating Your First Namespace 57

How to Declare a Namespace 58

How Exactly Does Scope Work? 62

Declaring More Than One Namespace 62

Changing a Namespace Declaration 64

Namespace Usage in the Real World 68

XML Schema 68

Documents with Multiple Namespaces 68

When to Use and Not Use Namespaces 72

When Namespaces are Needed 72

When Namespaces Are Not Needed 73

Versioning and Namespaces 74

Common Namespaces 75

The XML Namespace 75

The XMLNS Namespace 76

The XML Schema Namespace 76

The XSLT Namespace 76

The SOAP Namespaces 77

The WSDL Namespace 77

The Atom Namespace 77

The MathML Namespace 77

The Docbook Namespace 78

Summary 78

PART II: VALIDATION

CHAPTER 4: DOCUMENT TYPE DEFINITIONS 83

What Are Document Type Defi nitions? 83

Working with DTDs 84

Using jEdit 84

The Document Type Declaration in Detail 88

Sharing DTDs 92

Anatomy of a DTD 93

Element Declarations 93

Attribute Declarations 103

Entity Declarations 109

DTD Limitations 114

Summary 114

CHAPTER 5: XML SCHEMAS 117

Benefi ts of XML Schemas 118

XML Schemas Use XML Syntax 118

XML Schema Namespace Support 118

XML Schema Data Types 119

XML Schema Content Models 119

XML Schema Specifi cations 119

XML Schemas in Practice 120

Defi ning XML Schemas 124

<schema> Declarations 124

<element> Declarations 128

Mixed Content 138

<group> Declarations 139

<attribute> Declarations 141

An XML Schema for Contacts 141

Data Types 148

<simpleType> Declarations 155

Creating a Schema from Multiple Documents 161

<import> Declarations 161

<include> Declarations 165

Documenting XML Schemas 167

XML Schema 1.1 170

Relaxed Rules 170

<assert> 171

Summary 171

CHAPTER 6: RELAX NG AND SCHEMATRON 175

Why Do You Need More Ways of Validating XML? 176

Setting Up Your Environment 176

Using RELAX NG 177

Understanding the Basics of RELAX NG 177

Understanding RELAX NG’s Compact Syntax 183

Converting Between the Two RELAX NG Formats 185

Constraining Content 186

Reusing Code in RELAX NG Schema 189

Using Schematron 193

Understanding the Basics of Schematron 193

Choosing a Version of Schematron 194

Understanding the Basic Process 194

Writing Basic Rules in Schematron 195

Creating a Schematron Document 196

Adding More Information to Messages 197

Constraining Values in Schematron 200

Handling Co-Constraints in Schematron 202

Using Schematron from Within XML Schema 203

Summary 207

PART III: PROCESSING

CHAPTER 7: EXTRACTING DATA FROM XML 211

Document Models: Representing XML in Memory 211

Meet the Models: DOM, XDM, and PSVI 212

A Sample DOM Tree 212

DOM Node Types 213

DOM Node Lists 214

The Limitations of DOM 215

The XPath Language 216

XPath Basics 216

XPath Predicates: The Full Story 218

XPath Steps and Axes 220

XPath Expressions 222

Variables in XPath Expressions 226

New Expressions in XPath 2 227

XPath Functions 231

XPath Set Operations 234

XPath and Namespaces 234

Summary 236

CHAPTER 8: XSLT 239

What XSLT Is Used For 240

XSLT as a Declarative Language 240

How Is XSLT a Functional Language? 242

Setting Up Your XSLT Development Environment 242

Setting Up Saxon for .NET 243

Setting Up Saxon for Java 244

Foundational XSLT Elements 245

The <xsl:stylesheet> Element 246

The <xsl:template> Element 247

The <xsl:apply-templates> Element 251

The <xsl:value-of> Element 251

The <xsl:for-each> Element 253

Push-Processing versus Pull-Processing 254

The Role of XPath in XSLT 254

Using Named Templates 256

The <xsl:call-template> Element 259

The document() Function in XSLT 260

Conditional Logic 266

The <xsl:param> element 270

The <xsl:sort> Element 271

<xsl:copy> and <xsl:copy-of> Elements 273

Reusing Code in XSLT 276

The <xsl:include> Element 276

The <xsl:import> Element 279

The <xsl:template> Mode Attribute 280

Understanding Built-In Templates and Built-In Rules 282

Using XSLT 2.0 284

Understanding Data Types in XSLT 2.0 285

Creating User-Defi ned Functions 285

Creating Multiple Output Documents 290

Using the collection() Function 291

Grouping in XSLT 2.0 292

Handling Non-XML Input with XSLT 2.0 295

XSLT and XPath 3.0: What’s Coming Next? 302

Summary 303

PART IV: DATABASES

CHAPTER 9: XQUERY 307

XQuery, XPath, and XSLT 308

XQuery and XSLT 308

XQuery and XPath 308

XQuery in Practice 309

Standalone XQuery Applications 309

Part of SQL 309

Callable from Java or Other Languages 309

A Native-XML Server 310

XQuery Anywhere 310

Building Blocks of XQuery 313

FLWOR Expressions, Modules, and Functions 313

XQuery Expressions Do Not Have a Default Context 317

The Anatomy of a Query Expression 318

The Version Declaration 318

The Query Prolog 319

The Query Body 325

Some Optional XQuery Features 332

XQuery and XPath Full Text 332

The XQuery Update Facility 333

XQuery Scripting Extension 333

Coming in XQuery 3.0 333

Grouping and Windowing 334

The count Clause 335

Try and Catch 335

switch Expressions 336

Function Items and Higher Order Functions 337

JSON Features 338

XQuery, Linked Data, and the Semantic Web 338

Summary 338

CHAPTER 10: XML AND DATABASES 341

Understanding Why Databases Need to Handle XML 341

Analyzing which XML Features are Needed in a Database 343

Retrieving Documents 343

Retrieving Data from Documents 343

Updating XML Documents 344

Displaying Relational Data as XML 344

Presenting XML as Relational Data 344

Using MySQL with XML 345

Installing MySQL 345

Adding Information in MySQL 345

Querying MySQL 348

Updating XML in MySQL 353

Usability of XML in MySQL 353

Client-Side XML Support 354

Using SQL Server with XML 355

Installing SQL Server 355

Presenting Relational Data as XML 356

Understanding the xml Data Type 371

Creating Indexes with the xml Data Type 374

W3C XML Schema in SQL Server 384

Dealing with Namespaced Documents 385

Using eXist with XML 386

Downloading and Installing eXist 387

Interacting with eXist 389

Summary 399

PART V: PROGRAMMING

CHAPTER 11: EVENT-DRIVEN PROGRAMMING 403

Understanding Sequential Processing 404

Using SAX in Sequential Processing 404

Preparing to Run the Examples 405

Receiving SAX Events 406

Handling Invalid Content 417

Using the DTDHandler Interface 427

EntityResolver Interface 428

Understanding Features and Properties 429

Using XmlReader 434

Using XmlReaderSettings 441

Controlling External Resources 447

Summary 448

CHAPTER 12: LINQ TO XML 451

What Is LINQ? 451

Why You Need LINQ to XML 454

Using LINQ to XML 454

Creating Documents 457

Creating Documents with Namespaces 459

Creating Documents with Prefi xed Namespaces 460

Extracting Data from an XML Document 461

Modifying Documents 468

Adding Content to a Document 468

Removing Content from a Document 470

Updating and Replacing Existing Content in a Document 470

Transforming Documents 472

Using VB.NET XML Features 474

Using VB.NET XML Literals 474

Understanding Axis Properties in VB.NET 478

Managing Namespaces in VB.NET 480

Summary 480

PART VI: COMMUNICATION

CHAPTER 13: RSS, ATOM, AND CONTENT SYNDICATION 485

Syndication 485

XML Syndication 486

Syndication Systems 488

Format Anatomy 491

Working with News Feeds 501

Newsreaders 501

Data Quality 501

A Simple Aggregator 502

Modeling Feeds 502

Program Flow 505

Implementation 505

Extending the Aggregator 521

Transforming RSS with XSLT 524

Generating a Feed from Existing Data 524

Processing Feed Data for Display 528

Browser Processing 531

Preprocessing Feed Data 532

Reviewing the Diff erent Formats 532

Useful Resources 534

Summary 535

CHAPTER 14: WEB SERVICES 539

What Is an RPC? 539

RPC Protocols 541

COM and DCOM 541

COBRA and IIOP 542

Java RMI 543

The New RPC Protocol: Web Services 543

The Same Origin Policy 544

Understanding XML-RPC 546

Choosing a Network Transport 548

Understanding REST Services 559

The Web Services Stack 564

SOAP 565

WSDL 566

UDDI 566

Surrounding Specifications 567

Summary 569

CHAPTER 15: SOAP AND WSDL 573

Laying the Groundwork 574

The New RPC Protocol: SOAP 574

Comparing SOAP to REST 579

Basic SOAP Messages 579

More Complex SOAP Interactions 587

Defining Web Services: WSDL 600

<definitions> 601

<types> 601

<messages> 602

<portTypes> 602

<binding> 603

<service> 605

Other Bindings 609

Summary 612

CHAPTER 16: AJAX 615

AJAX Overview 615

AJAX Provides Feedback 616

Loading Incomplete Data With AJAX 616

AJAX Performs Asynchronous Operations 617

Introduction to JavaScript 617

The Web Browser Console 618

Values, Expressions, and Variables 619

Control Flow Statements 621

Properties, Objects, Functions and Classes 622

The XMLHttpRequest Function 623

Using HTTP Methods with AJAX 628

Accessibility Considerations 629

The jQuery Library 630

Learning jQuery 631

The Domain-Specifi c Language (DSL) Approach 631

jQuery Plug-ins and Add-On Libraries 632

JSON and AJAX 635

JSON Example 635

JSON Syntax 636

JSON and jQuery 636

JSONP and CORS 637

The Web Sever Back End 637

Sending Images and Other Non-Textual Data 638

Performance 638

The Server Logs Are Your Friend 639

A Larger Example 639

Summary 644

PART VII: DISPLAY

CHAPTER 17: XHTML AND HTML 5 649

Background of SGML 650

HTML and SGML 650

XML and SGML 651

The Open Web Platform 651

Introduction to XHTML 652

The XHTML <html> Element 653

The XHTML <head> Element 654

The XHTML <body> Element 656

More Advanced HTML Topics 668

XHTML and HTML: Problems and Workarounds 669

Cascading Style Sheets (CSS) 670

CSS Levels and Versions 670

CSS at a Glance 671

CSS Selectors 673

CSS Properties 675

CSS Special Rules 680

CSS and XML 681

Separating Style and Markup: Unobtrusive CSS 682

Unobtrusive JavaScript 682

HTML 5 683

Benefits of HTML 5 683

Caveats of HTML 5 683

New Elements in HTML 5 684

Summary 686

CHAPTER 18: SCALABLE VECTOR GRAPHICS (SVG) 689

Scalable Vector Graphics and Bitmaps 689

Procedural Graphics 690

Declarative Graphics 690

Bitmap Graphics 691

Vector Images 692

SVG Images 692

The SVG Graphics Model 694

SVG and CSS 696

SVG Tools 698

SVG Basic Built-in Shapes 700

Rectangles 701

Circles 702

Ellipses 702

Straight Lines 703

Polylines and Polygons 704

SVG Paths 705

SVG Transforms and Groups 708

Transforms 708

Groups 709

SVG Defi nitions and Metadata 709

The SVG <title> and <desc> Elements 709

The SVG <metadata> Element 710

The SVG <defs> Element and Reusable Content 711

Viewports and Coordinates 712

SVG Colors and Gradients 713

Including Bitmap Images in SVG 715

SVG Text and Fonts 716

SVG Animation Four Ways 717

Synchronized Multimedia Integration Language (SMIL) 718

Scripted Animation 719

CSS Animation 719

External Libraries 720

SVG and HTML 5 720

SVG and Web Apps 721

Making SVG with XQuery or XSLT 722

Resources 722

Summary 723

PART VIII: CASE STUDY

CHAPTER 19: CASE STUDY: XML IN PUBLISHING 727

Background 727

Project Introduction: Current Workfl ow 728

Introducing a New XML-Based Workfl ow 728

Consultations 729

Documenting the Project 729

Prototyping 729

Creating a New Process 730

Challenging Criteria 730

The New Workfl ow 731

Document Conversion and Technologies 731

Costs and Benefi ts Analysis 732

Deployment 733

Some Technical Aspects 733

XQuery and Modules 734

XInclude 734

Equations and MathML 734

XProc: An XML Pipelining Language 737

XForms, REST, and XQuery 738

Formatting to PDF with XSL-FO 738

XML Markup for Documentation 741

Markup for the Humanities: TEI 741

The Hoy Books Website 741

Summary 746

APPENDIX A: ANSWERS TO EXERCISES 749

APPENDIX B: XPATH FUNCTIONS 773

APPENDIX C: XML SCHEMA DATA TYPES 797

INDEX 811

Rewards Program

Write a Review