Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Professional ASP.NET 2.0 XML
PREMIUM
Số trang
594
Kích thước
10.6 MB
Định dạng
PDF
Lượt xem
1101

Professional ASP.NET 2.0 XML

Nội dung xem thử

Mô tả chi tiết

Professional ASP.NET 2.0 XML

01_596772 ffirs.qxd 12/13/05 11:22 PM Page i

01_596772 ffirs.qxd 12/13/05 11:22 PM Page ii

Professional ASP.NET 2.0 XML

Thiru Thangarathinam

01_596772 ffirs.qxd 12/13/05 11:22 PM Page iii

Professional ASP.NET 2.0 XML

Published by

Wiley Publishing, Inc.

10475 Crosspoint Boulevard

Indianapolis, IN 46256

www.wiley.com

Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN-13: 978-0-7645-9677-3

ISBN-10: 0-7645-9677-2

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form

or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as per￾mitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior writ￾ten permission of the Publisher, or authorization through payment of the appropriate per-copy fee to

the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978)

646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley

Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or

online at http://www.wiley.com/go/permissions.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR

MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR

COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WAR￾RANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR

PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL

MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE

FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUB￾LISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL

SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT

PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR

SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION

OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE

OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER

ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR REC￾OMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET

WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN

THIS WORK WAS WRITTEN AND WHEN IT IS READ.

For general information on our other products and services please contact our Customer Care Depart￾ment within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317)

572-4002.

1MA/QT/QR/QW/IN

Library of Congress Control Number is available from the publisher.

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related

trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in

the United States and other countries, and may not be used without written permission. All other

trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with

any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may

not be available in electronic books.

01_596772 ffirs.qxd 12/13/05 11:22 PM Page iv

About the Author

Thiru Thangarathinam works for Intel Corporation in Phoenix, Arizona. He is an MCAD (Microsoft

Certified Application Developer) and specializes in architecting and building Distributed N-Tier applica￾tions using ASP.NET, Visual C#.NET, VB.NET, ADO.NET, and SQL Server 2000. He has co-authored a

number of books for Wrox Press in .NET technologies. Thiru is also a regular contributor to print and

online magazines such as Visual Studio Magazine, Visual Studio .NET Professional, SQL Server

Professional, DevX, ASPToday.com, 15seconds.com, and Developer.com. At Intel, he is part of the team

that is focused on developing the Enterprise Architecture and Service Oriented Architectures for Intel.

He can be reached at [email protected].

01_596772 ffirs.qxd 12/13/05 11:22 PM Page v

01_596772 ffirs.qxd 12/13/05 11:22 PM Page vi

Credits

Senior Acquisitions Editor

Jim Minatel

Development Editor

Ed Connor

Technical Editor

Kirk Evans

Production Editor

Pam Hanley

Copy Editor

Susan Hobbs

Editorial Manager

Mary Beth Wakefield

Production Manager

Tim Tate

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Joseph B. Wikert

Project Coordinator

Ryan Steffen

Graphics and Production Specialists

Carrie A. Foster

Lauren Goddard

Denny Hager

Barbara Moore

Alicia B. South

Quality Control Technician

Brian H. Walls, Joe Niesen

Proofreading and Indexing

TECHBOOKS Production Services

01_596772 ffirs.qxd 12/13/05 11:22 PM Page vii

01_596772 ffirs.qxd 12/13/05 11:22 PM Page viii

Contents

Acknowledgements xv

Introduction xvii

Chapter 1: Introduction to XML 1

A Primer on XML 2

Self-Describing Data 2

Basic Terminology 3

Components of an XML Document 4

Namespaces 8

XML Technologies 12

DTD 12

XDR 13

XSD 14

XSLT 17

XML DOM 18

XPath 18

SAX 19

XLink and XPointer 20

XQuery 20

The XML Advantage 20

Summary 21

Chapter 2: Introduction to ASP.NET 2.0 23

ASP.NET 2.0 Features 23

Developer Productivity 23

Administration and Management 35

Speed and Performance 37

Summary 40

Chapter 3: XML Classes in the .NET Framework 41

XML Support in the .NET Framework 2.0 41

Design Goals for XML Support in .NET Framework 2.0 41

XML Namespaces 42

XML Parsing 43

02_596772 ftoc.qxd 12/13/05 11:12 PM Page ix

x

Contents

Writing XML 46

XPath Support 46

XML Schema Object Model (SOM) 47

Understanding XML Validation 49

Transforming XML Data using XSLT 49

XML Serialization 51

XML Web Services 52

XML and ADO.NET 56

ASP .NET Configuration 57

Summary 59

Chapter 4: Reading and Writing XML Data Using XmlReader and XmlWriter 61

XML Readers and Writers 62

Reading XML with XmlReader 63

Overview of XmlReader 63

Steps Involved in Using XmlReader to Read XML Data 64

Writing XML Data 83

Writing XML Data with XmlWriter 83

Summary 96

Chapter 5: XML Data Validation 99

XML Validation 100

Validation Types Supported in .NET Framework 2.0 100

XML Data Validation Using XSD Schemas 101

A Cache for Schemas 107

XML DOM Validation 110

XML Validation Using Inline Schemas 112

Using DTDs 115

Creating an XML Schema with Visual Studio 2005 119

The .NET Schema Object Model (SOM) 122

Programmatically Inferring XSD Schema from an XML File 129

Summary 130

Chapter 6: XML DOM Object Model 131

Exploring DOM Processing 132

XML Document Loaded in a DOM Tree 132

Programming with the XML Document Object Model 134

Document Classes 135

Collection Classes 136

The XmlDocument Class 136

02_596772 ftoc.qxd 12/13/05 11:12 PM Page x

xi

Contents

Working with XmlDocument Class 139

Programmatically Creating XML Documents 149

The XmlDocumentFragment Class 159

XPath Support in XML DOM 159

Validating XML in an XmlDocument 171

Summary 171

Chapter 7: Transforming XML Data with XSLT 173

A Primer on XSLT 174

What Is XSLT, XSL, and XPath? 174

Need for XSLT 175

XSLT Elements 176

XSLT Functions 179

Applying an XSL Style Sheet to an XML Document 179

.NET Classes Involved in XSL Transformation 186

User Defined Functions in an XSL Style Sheet 193

The XsltSettings Class 198

A Complete Example 199

Advanced XSLT Operations 207

Debugging XSLT Style Sheets 209

Summary 211

Chapter 8: XML and ADO.NET 213

ADO.NET and XML 214

Loading XML into a DataSet 214

DataSet Schemas 218

Transforming DataSet to XML 222

Typed DataSets 230

XmlDataDocument Object and DataSet 235

Relationship between XmlDataDocument

and XPathNavigator 242

DataTable and XML 243

Summary 245

Chapter 9: XML Data Display 247

ASP.NET 2.0 Hierarchical Data Controls 248

Site Navigation 248

XmlDataSource Control 251

Caching 262

Xml Web Server Control 265

02_596772 ftoc.qxd 12/13/05 11:12 PM Page xi

xii

Contents

Client-Side XML 272

ASP.NET 2.0 Callback Feature 272

ASP.NET Atlas Technology 280

Summary 284

Chapter 10: SQL Server 2005 XML Integration 287

New XML Features in SQL Server 2005 288

FOR XML in SQL Server 2005 289

Executing FOR XML Queries from ADO.NET 290

XML Data Type in SQL Server 2005 298

Working with XML Data Type Columns from ADO.NET 303

Using XML Schema on the Client 317

Multiple Active Result Sets (MARS) in ADO.NET 323

XML Data Type and a DataSet 326

OPENXML() 329

Other XML Features 332

Summary 333

Chapter 11: Building an Airline Reservation System

Using ASP.NET 2.0 and SQL Server 2005 335

Overview of the Case Study 336

Architecture of System 336

Business Processes 336

Implementation 337

Database Design 337

Implementation of AirlineReservationsLib Component 342

Implementation of Web Site 349

Putting It All Together 374

Summary 375

Chapter 12: XML Serialization 377

A Primer on Serialization 378

The XmlSerializer Class 379

Advanced Serialization 384

Deserializing XML 394

Generics and XML Serialization 403

Pregenerating Serialization Assemblies 407

Handling Exceptions 408

Summary 409

02_596772 ftoc.qxd 12/13/05 11:12 PM Page xii

xiii

Contents

Chapter 13: XML Web Services 411

XML Web Service 412

Building an ASP.NET Web Service 412

Creating a Proxy Class for the Web Service 416

Returning Complex Types 420

Using SOAP Headers 431

Using SOAP Extensions 436

Asynchronous Invocation of Web Services from a Client Application 443

Asynchronous Invocation of Web Services from a Browser Using IE Web Service Behavior 448

Asynchronous Web Service Methods 454

Controlling XML Serialization Using IXmlSerializable 457

Using Schema Importer Extensions 460

Miscellaneous Web Service Features in .NET

Framework 2.0 463

Summary 464

Chapter 14: ASP.NET 2.0 Configuration 465

ASP.NET Configuration 466

Configuration Hierarchy 466

ASP.NET 1.x Way of Accessing Configuration Sections 467

ASP.NET 2.0 Configuration Management 467

New Configuration Sections in ASP.NET 2.0 468

WebConfigurationManager Class 471

Retrieving Configuration from Predefined Sections 473

Encrypting and Decrypting Configuration Sections 478

Enumerating Configuration Sections 482

Reading Configuration Sections 483

Creating a Custom Configuration Section 487

Built-in Configuration Management Tools 491

Summary 495

Chapter 15: Building a ShoppingAssistant Using XML Web Services 497

ShoppingAssistant Case Study 497

Architecture of ShoppingAssistant 498

Business Processes 499

Implementation 500

Database Design 501

Implementation of ContentPublisher Web Service 503

Implementation of ShoppingAssistantLib Component 511

02_596772 ftoc.qxd 12/13/05 11:12 PM Page xiii

xiv

Contents

Implementation of ShoppingAssistant Web Application 513

Using Asynchronous Invocation of Web Services and Windows Service 526

Modifying the ShoppingAssistant Web Pages to Consume XML Files 531

Implementation of FileSystemWatcher to Facilitate Reporting Data Collection 532

Putting It All Together 538

Summary 539

Index 541

02_596772 ftoc.qxd 12/13/05 11:12 PM Page xiv

Tải ngay đi em, còn do dự, trời tối mất!
Professional ASP.NET 2.0 XML | Siêu Thị PDF