Gekko Software
Services
Portfolio
iPhone apps
Publications
Contact
Blog
About

XML for ASP.NET developers

Author : Dan Wahlin

Sams

ISBN-0-672-32039-8

This book is an in depth coverage of XML in a historical background. Although it is targeted at ASP.NET developers it contains an extensive coverage of matters not (yet) implemented in .NET as XPointer and Xlink and "outdated " matters which were never fully supported by .NET, like DTD. If XML is just a technology behind the scenes to you, you should read Applied XML programming for Microsoft .NET. If you want a good background on XML this is the book to read and if you're really serious about .NET you should read both.

The book consists of 10 chapters, the author does not group these. Discussing the chapters in groups is just my view on the book

  • XML basics

The first part is a general coverage of the basics of XML. Chapter 1 provides a history from the origins of XML to the introduction of the System.Xml namespace in the .NET framework. Chapter 2 is a very clear and accurate explanation of all the parts which make up an XML document. It ends with a C# program which assembles an XML document all by hand. Chapter 3 deals with XPath, XPointer and XLlink. Xpath is a technique to find data in an XML document and is fully supported by the .NET framework. XPointer is a technique to find data in multiple XML documents, it is still in the stage of a W3C recommendation and not (yet) implemented in the .NET framework. XLink deals with complex bidirectional relations between multiple (also non XML) resources and has not even reached the status of recommendation, you will not find an implementation of it in the .NET framework either. Chapter 4 deals with schema's. A schema is the metadata of an XML document and is used, amongst others, to validate the contents of an XML document. Dan covers classical DTD schemas and XML-DR schemas before he comes to the W3C-XML schema which is better known in .NET as an XSD and the only type of schema really supported by the framework.

  • XML programming in .NET

The second part concentrates on XML programming in a .NET application. In chapter 5 Dan covers the XMLtextReader and the XMLtextWriter. The readers pulls the XML out of a stream and parses it. Dan compares this to the classical SAX parser which pushes fragments of XML to your code and shows how to implement this push model of XML parsing using the pulling .NET XML reader. The chapter ends with some C# programs which generate XML documents out of bare strings or other legacy data. Chapter 6 deals with the Document Object Model (DOM). In a detailed description the XMLDocument class, its methods and its properties are covered. Dan does describe how XPath can be used to navigate through the nodes but he does not treat the XPathDocument class yet. To end the chapter a sample C# application demonstrates some of the many things you can do with an XMLdocument. Chapter 7 is dedicated to XSLT transformations. First the XSLT language and the way this language transforms an XML document into another document is covered. After that the .NET classes which implement XSLT in the framework are treated. XSLT uses XPath as a language for it's expressions, here the XPathDocument class comes into view as wrapper for the data and the XslTransform class to perform the transformation of the data.

  • XML and databases

Standard .NET code works with disconnected XML data, the data is read out and written to the database using data-adapter objects. In Chapter 8 Dan introduces this way of thinking as seen from a classical ADO background and then focuses on the dataset component. DataSet objects can have a second representation as an XMLdataDocument, where the .NET framework keeps the content of the two in sync. Most of the .NET components work with the dataset, most of the typical XML components like XSLT and XPath work with a XML(data)document. Chapter 9 deals with the XML features of SQL server 2000. This database can be addressed in XML. The nice thing about this that it does work over the HTTP protocol, the client does not need a proprietary SQL connection to the database. Dan explains how to set up an HTTP connection to the database and read and write data using XML. Most of the code uses a lot of HTML and SQL, many classes of the framework are used but the framework itself does not provide the overall view of this matter. In a typical ASP.NET application the database is accessed from the webserver and only the resulting HTML pages are seen by the client. In some of the code here the (webbrowser) client itself is accessing the database or the server code is bypassing the sql provider to fill the dataset. These are scenarios which are not in the mainstream of ASP.NET but form a clear demonstration how much more you can do with the framework.

  • XML and web services

The final chapter 10 is dedicated to webservices, SOAP, the way they use XML and their implementation in ASP.NET. Dan starts with discussing the problem web services try to solve, providing programmable functionality over the internet, and the possible alternatives to achieve this goal.  Follows a detailed description of SOAP messages. These rely fully on XML as a format, many of the subjects covered in the book come back here. Besides the parts of a SOAP message which describe the functionality also the ways to encode (complex) data in the SOAP body is treated in detail. SOAP describes the messages sent by web services, next comes a discussion on the way web services work and the way they are implemented in ASP.NET. The chapter and book end with a clear example how to build a web service and how to use (or consume as the saying goes) a web service in ASP.NET.

Conclusion

This book takes a bottom up approach. It starts with plain XML, describes all of the details and ends with the ASP.NET implementation. When you work with Visual Studio.NET you will usually not even see the XML itself, you will only see the classes generated by the wizards. The MS-Press book on XML programming bypasses a lot of the (essential) background on XML. If you want to understand more about XML this the book to read. Dan Wahlin is an expert on the matter and writes in a beautiful style which is very pleasant to read and easy to understand. I would Absolutely recommend this book as a background and as a reference guide.


© Peter van Ooijen. Gekko Software, 2001-2011