IN THIS CHAPTER
Extensible Markup Language (XML) is a set of guidelines for describing structured data in plain text. These guidelines are defined as a specification by the World Wide Web Consortium (W3C; www.w3.org), the body that sets the standards for the Web. Because of its textual nature, XML has been widely adopted as a platform-independent format for data representation. Some of the current applications of XML include exchange of data over the Internet, application integration, content management and document publishing, use as configuration files, news/weblog syndication (RSS), and use as a file format such as Word documents stored as XML.
With the increased use of XML for representing documents and forms, more and more developers want to store XML documents directly into databases and also be able to effectively query and retrieve the XML data. SQL Server 2005 is the first release that has native support for XML storage and querying. This chapter shows you how to store XML data in a database column, index it, modify it, and query it by using another W3C specification, called XQuery.
In addition to the new XML data type and XQuery querying capabilities, SQL Server 2005 also includes enhancements to the OPENROWSET function to allow bulk loading of XML data, as well as several enhancements to the existing FOR XML clause.
The other topic discussed in this chapter is HTTP SOAP or web services support in SQL Server 2005. HTTP SOAP support in SQL Server 2005 allows you to execute T-SQL batches, stored procedures, and scalar-valued user-defined functions over the Internet, from any client platform. For instance, a Unix client application can use Perl to post a SOAP request envelope over the Internet (via HTTP or HTTPS) to a SQL Server 2005 web service method, which in turn can execute a batch or a stored procedure or a function on the server side and return a SOAP response envelope, which is an XML document that contains the results, which can be then parsed by the client Perl application on the Unix machine. This enables cross-platform application integration. You do not need Microsoft Internet Information Server (IIS) or any web server to enable and use the web services support in SQL Server 2005. The second part of this chapter discusses this in great detail.
Before looking at XML support in SQL Server 2005, here is a quick introduction to XML.