Contents Acknowledgements Introduction xv xvii AL Chapter 1: Introduction to XML RI A Primer on XML TE Self-Describing Data Basic Terminology Components of an XML Document Namespaces MA XML Technologies PY RI The XML Advantage Summary GH TE D DTD XDR XSD XSLT XML DOM XPath SAX XLink and XPointer XQuery Chapter 2: Introduction to ASP.NET 2.0 CO ASP.NET 2.0 Features Developer Productivity Administration and Management Speed and Performance Summary Chapter 3: XML Classes in the .NET Framework XML Support in the .NET Framework 2.0 Design Goals for XML Support in .NET Framework 2.0 XML Namespaces XML Parsing 1 2 2 3 4 8 12 12 13 14 17 18 18 19 20 20 20 21 23 23 23 35 37 40 41 41 41 42 43 Contents Writing XML XPath Support XML Schema Object Model (SOM) Understanding XML Validation Transforming XML Data using XSLT XML Serialization XML Web Services XML and ADO.NET ASP .NET Configuration Summary Chapter 4: Reading and Writing XML Data Using XmlReader and XmlWriter XML Readers and Writers Reading XML with XmlReader Overview of XmlReader Steps Involved in Using XmlReader to Read XML Data Writing XML Data Writing XML Data with XmlWriter Summary Chapter 5: XML Data Validation XML Validation Validation Types Supported in .NET Framework 2.0 XML Data Validation Using XSD Schemas A Cache for Schemas XML DOM Validation XML Validation Using Inline Schemas Using DTDs Creating an XML Schema with Visual Studio 2005 The .NET Schema Object Model (SOM) Programmatically Inferring XSD Schema from an XML File Summary Chapter 6: XML DOM Object Model Exploring DOM Processing XML Document Loaded in a DOM Tree Programming with the XML Document Object Model Document Classes Collection Classes The XmlDocument Class x 46 46 47 49 49 51 52 56 57 59 61 62 63 63 64 83 83 96 99 100 100 101 107 110 112 115 119 122 129 130 131 132 132 134 135 136 136 Contents Working with XmlDocument Class Programmatically Creating XML Documents The XmlDocumentFragment Class XPath Support in XML DOM Validating XML in an XmlDocument Summary Chapter 7: Transforming XML Data with XSLT A Primer on XSLT What Is XSLT, XSL, and XPath? Need for XSLT XSLT Elements XSLT Functions Applying an XSL Style Sheet to an XML Document .NET Classes Involved in XSL Transformation User Defined Functions in an XSL Style Sheet The XsltSettings Class A Complete Example Advanced XSLT Operations Debugging XSLT Style Sheets Summary Chapter 8: XML and ADO.NET ADO.NET and XML Loading XML into a DataSet DataSet Schemas Transforming DataSet to XML Typed DataSets XmlDataDocument Object and DataSet Relationship between XmlDataDocument and XPathNavigator DataTable and XML Summary Chapter 9: XML Data Display ASP.NET 2.0 Hierarchical Data Controls Site Navigation XmlDataSource Control Caching Xml Web Server Control 139 149 159 159 171 171 173 174 174 175 176 179 179 186 193 198 199 207 209 211 213 214 214 218 222 230 235 242 243 245 247 248 248 251 262 265 xi Contents Client-Side XML ASP.NET 2.0 Callback Feature ASP.NET Atlas Technology Summary Chapter 10: SQL Server 2005 XML Integration New XML Features in SQL Server 2005 FOR XML in SQL Server 2005 Executing FOR XML Queries from ADO.NET XML Data Type in SQL Server 2005 Working with XML Data Type Columns from ADO.NET Using XML Schema on the Client Multiple Active Result Sets (MARS) in ADO.NET XML Data Type and a DataSet OPENXML() Other XML Features Summary Chapter 11: Building an Airline Reservation System Using ASP.NET 2.0 and SQL Server 2005 Overview of the Case Study Architecture of System Business Processes Implementation Database Design Implementation of AirlineReservationsLib Component Implementation of Web Site Putting It All Together Summary Chapter 12: XML Serialization A Primer on Serialization The XmlSerializer Class Advanced Serialization Deserializing XML Generics and XML Serialization Pregenerating Serialization Assemblies Handling Exceptions Summary xii 272 272 280 284 287 288 289 290 298 303 317 323 326 329 332 333 335 336 336 336 337 337 342 349 374 375 377 378 379 384 394 403 407 408 409 Contents Chapter 13: XML Web Services XML Web Service Building an ASP.NET Web Service Creating a Proxy Class for the Web Service Returning Complex Types Using SOAP Headers Using SOAP Extensions Asynchronous Invocation of Web Services from a Client Application Asynchronous Invocation of Web Services from a Browser Using IE Web Service Behavior Asynchronous Web Service Methods Controlling XML Serialization Using IXmlSerializable Using Schema Importer Extensions Miscellaneous Web Service Features in .NET Framework 2.0 Summary Chapter 14: ASP.NET 2.0 Configuration ASP.NET Configuration Configuration Hierarchy ASP.NET 1.x Way of Accessing Configuration Sections ASP.NET 2.0 Configuration Management New Configuration Sections in ASP.NET 2.0 WebConfigurationManager Class Retrieving Configuration from Predefined Sections Encrypting and Decrypting Configuration Sections Enumerating Configuration Sections Reading Configuration Sections Creating a Custom Configuration Section Built-in Configuration Management Tools Summary Chapter 15: Building a ShoppingAssistant Using XML Web Services ShoppingAssistant Case Study Architecture of ShoppingAssistant Business Processes Implementation Database Design Implementation of ContentPublisher Web Service Implementation of ShoppingAssistantLib Component 411 412 412 416 420 431 436 443 448 454 457 460 463 464 465 466 466 467 467 468 471 473 478 482 483 487 491 495 497 497 498 499 500 501 503 511 xiii Contents Implementation of ShoppingAssistant Web Application Using Asynchronous Invocation of Web Services and Windows Service Modifying the ShoppingAssistant Web Pages to Consume XML Files Implementation of FileSystemWatcher to Facilitate Reporting Data Collection Putting It All Together 513 526 531 532 538 Summary 539 Index 541 xiv