Chris Knowles
Chris started in IT in the late eighties as a mainframe programmer. Contracting took him throughout the UK, on to Dallas, Texas, and then Australia for a short twelve-month contract. Six years later he is still in Australia but, much to the relief of his parent's address book, has finally settled down just outside Canberra, the national capital. He lives there with his Australian wife, Louise, their two fantastic young kids, Katie and Matty, Banjo the dog, Bourbon the horse, M
Ever since XML first arrived on the scene in the late 1990s, it has been the focus of a lot of fervent activity and wild speculation. Now, it is beginning to come of age, and it's steadily permeating an increasing proportion of the computing world. Based on nothing but ordinary text, it offers a means of communication between just about any two computer systems, be they new or old, on an intranet, or across the world on the other side of a company firewall.
XML, together with the XML-based standard of SOAP, forms an important part of the structure upon which Web Services are built, and this will only increase its prevalence and importance. It will become increasingly important for web developers to know how to capitalize on XML and its related technologies, so that they can efficiently extract data from XML documents, filter it, merge it, and display it in applications - especially web applications.
ASP.NET can handle XML data from a wide range of sources, from plain old XML documents on disk,to relational databases on remote servers. In this book, we'll examine how to access these sources, apply transformations to the data once we have it, and render that data for display. We'll also look at how to analyze the performance of our XML web applications, interpret the results to remove bottlenecks, and put it all together in an e-commerce case study.
Microsoft's .NET Framework makes heavy use of XML, and forms the perfect platform for creating web applications with XML functionality. In this book, we'll investigate the areas of ASP.NET that developers will need to exploit in order to create useful and efficient web applications that use XML.
Who Is This Book For?
This book is aimed at the experienced web developer who already has a grasp of ASP.NET and Cqf, and a basic familiarity with XML and related technologies.
Intermediate in level, this book aims to augment the skill set of those seeking to progress their .NET experience, and to discover how to apply the XML capabilities of the .NET Framework to their web applications.
What Does This Book Cover?
Chapter I provides a quick roadmap of the world of web development, looking at important architectures that can be applied, and taking a quick tour of XML-related specifications and standards that you may encounter when programming for the Web.
Chapter 2 discusses two fundamental classes for handling XML from web pages - XmlReader and XmlWriter - and their derived classes. These are lightweight classes that provide an efficient but forward-only way of reading and writing XML documents, and offer validation against an XML Schema or DTD if required.
Chapter 3 moves on to cover the more powerful but consequently less efficient XmlDocument class, and associated classes for manipulating XML structures. Based on the W3C Document Object Model (DOM) specification, this class supports random access to elements and attributes, and lets us filter data according to our requirements.
Chapter 4 examines the XPath standard, which underpins many technologies that surround XML, and is sometimes referred to as the SQL of XML. We see how to use its non-XML syntax to search through an XML document from ASP.NET, and extract only those elements that we want to look at further.
Chapter 5 takes a close look at ASP.NET's support for the XML language for transforming XML documents from one format to another: XSLT. We see how this technology can allow us to render data taken from XML documents or relational databases for display in an HTML browser.
Chapter 6 checks out the key features of the cornerstone of XML data access in .NET - namely, ADO.NET - and demonstrates its intrinsic capabilities for handling XML. We use a DataSet object in an ASP.NET page to read data from an XML document and a relational database, applying an XSLT stylesheet for good measure.
Chapter 7 looks at the .NET classes that are specially tailored for accessing relational data from SQL Server databases. We show how to query SQL Server to obtain results in XML format, and how to capture those results for display in our ASP.NET pages. Chapter 8 delves into the world of XML Web Services, examining the transport protocols and structures that enable these poster children of the Internet age to interact with all manner of computers, from modern palmtops, to monolithic mainframes.
Chapter 9 introduces a web application based on the upcoming XQuery technology, using Microsoft's add-in XQuery classes, which conform to the W3C Working Draft. XQuery is an XML-based language for specifying queries to run against XML documents, and as we see here, is now sufficiently advanced to capitalize upon in web applications.
Chapter 10 examines that important topic for all web developers: application performance,concentrating on applications that use XML. We have a close look at how the Application Center Test product, included with Visual Studio .NET Enterprise Edition, can be used to highlight performance trouble spots.
We cap it all off with an in-depth Case Study to see how what we've learned during the course of the book can be applied to a real-world web site. We walk through the process of creating a fully functioning XML-dependent e-commerce site, with a product catalog from which items can be added to a basket, and then orders placed.
What You Need to Use This Book
To run the samples in this book, you need to have the following software installed:
Windows 2000/XP Professional or higher, with IIS installed
Any version of Visual Studio .NET
SQL Server 2000, or MSDE (provided with VS.NET)
In addition, the book assumes:
An intermediate knowledge of the C# language
A basic understanding of SQL Server and its query syntax
Some familiarity with XML
Conventions
We've used a range of different styles of text and layout in this book to help differentiate between the different kinds of information. This section contains examples of the styles used, together with explanations of what they mean.
Code has several styles. If we're talking about code in the text - for example, if we're discussing a for loop - it's in this font. If it's a block of code that can be typed as a program and run, then it will appear separate from the main text, within a gray box:
Sometimes, code is presented in a mixture of styles, like this:
Widget
S10. O0
In this case, the code with a white background is code we have already seen, while lines highlighted in
gray represent new code to be added to the program.
Advice, hints, and background information come in this type of font.
Important pieces of information appear in boxes like this.
Bullet points appear indented, and marked as follows:
Important words use a bold type font.
Words that appear on the screen, or in menus like Open or Close options, are in a similar
sans-serif font to the one you might see on a Windows desktop.
Words that represent keys to press on the keyboard are shown in italics, like Ctrl and Enter.
Customer Support
We always value hearing from our readers, and we want to know what you think about this book: what you liked; what you didn't like, and what you think we can do better next time. You can send us your comments, either by returning the reply card in the back of the book, or by e-mail to feedback@wrox.com. Please be sure to mention the book title in your message.
How to Download the Sample Code for the Book
When you visit the Wrox web site, www.wrox.com, locate the title through our Search facility or by using on of the title lists. Click Download Code on the book's detail page, or on the Download item in the Code column for title lists.
The files that are available for download from our site have been archived using WinZip. When you've saved the archives to a folder on your hard drive, you need to extract the files using a decompression program such as WinZip or PKUnzip. When you extract the files, the code will be extracted into separate folders for each chapter of this book, so ensure your extraction utility is set to use folder names.Errata
We've made every effort to make sure that there are no errors in the text or in the code. However, no one is perfect and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful to hear about it. By sending in errata you may save another reader hours of frustration, and of course, you will be helping us to provide even higher quality information. Simply e-mail the information to support@wrox.com - your information will be checked and if correct, posted to the errata page for that title, and used in reprints of the book.
To find errata on the web site, go to www.wrox.com, and simply locate the title through our Advanced Search or title list. Click the Book Errata link below the cover graphic on the book's detail page.
E-Mail Support
If you wish to query a problem in the book with an expert who knows the book ii1 detail, then e-mail support@wrox.com with the title of the book and the last four numbers of the ISBN in the subject field of the e-mail. A typical e-mail should include the following things:
The title of the book, the last four digits of the ISBN (7248), and the page number of the problem. Your name, contact information, and the problem in the body of the message.
We need the above details to save your time and ours - we never send unsolicited junk mail. When you send an e-mail message, it will go through the following chain of support:
Customer Support - Your message is delivered to our customer support staff, who are the first people to read it. They have files on most frequently asked questions and will answer anything general about the book or the web site immediately.
Editorial - Deeper queries are forwarded to the technical editor responsible for that book.
They have experience with the programming language or particular product, and are able to answer detailed technical questions on the subject.
The Authors - Finally, in the unlikely event that the editor cannot answer your problem, they will forward the request to the author. All Wrox authors are glad to help support their books. They will e-mail the customer and the editor with their response, and again all readers should benefit.
The Wrox support process can only offer support for issues that are directly pertinent to the content of our published title. Support for questions that fall outside the scope of normal book support is provided via the community lists of our http://p2p.wrox.com/forum.
p2p.wrox.com
For author and peer discussion, join the P2P mailing lists. Our unique system provides programmer to programmerTM contact on mailing lists, forums, and newsgroups, all in addition to our one-to-one e-mail support system. If you post a query to P2P, you can be confident that the many Wrox authors and other industry experts who are present on our mailing lists are examining it. At p2p.wrox.com, you will find a number of different lists that will help you not only while you read this book, but also as you develop your own applications. Particularly appropriate to this book are the aspx and the aspx_professional lists.
To subscribe to a mailing list, just follow these steps:
1. Go to http://p2p.wrox.com/.
2. Choose the appropriate category from the left menu bar.
3. Click on the mailing list you wish to join.
4. Follow the instructions to subscribe, and fill in your e-mail address and password.
5. Reply to the confirmation e-mail you receive.
6. Use the subscription manager to join more lists and set your e-mail preferences.
Why this System Offers the Best Support
You can choose to join the mailing lists, or you can receive them as a weekly digest. If you don't have the time (or the facility) to receive the mailing lists, then you can search our online archives. Junk and spam mails are deleted, and your own e-mail address is protected by the Lyris system. Queries about joining or leaving lists, and any other general queries about lists, should be sent to listsupport @ p2p.wrox.com.