SQL Server 2005 XML


It came out of nowhere. Suddenly there was XML, and now everyone is labeling this language as the “Lingua Franca of the World Wide Web.” But there is lot more to XML than a stale cliché. While there are a lot of good books on XML and tons of material on the Internet, this brief introduction investigates XML in the context of its value to SQL Server 2005 and to you, the SQL Server developer or DBA or both.

If you are new to XML, this section will give you the heads-up, and what you need to know before you go out and grab a six-pack of XML tomes (see also Chapter 10, which describes the XML data type in SQL Server 2005). After introducing XML we will briefly cover several important XML constructs supported by SQL Server 2005.

So what exactly is XML? Well, in short, XML is simply data formatted in a certain way. The Microsoft XML SDK defines XML as “a meta-markup language that provides a format for describing structured data.” And actually, this is precisely the case. XML is simply a way of formatting data so that it is “self-describing and easy to transform.”

XML had its beginnings years ago, circa 1986, as the Standardized General Markup Language (SGML) came to be a standard for marking up data in a way that would facilitate easy transformation and description of information. The goal of the SGML architects was to define a way in which any type of data could be transferred and processed by any type of application, written in any programming language, and processed automatically. This means that there would be no need to write special conversion programs, protocols, and so on, just to handle someone else’s data.

The problem from the beginning was that SGML was very complex. I guess everyone was afraid of it. Anything too complex will never be totally accepted. So in comes XML, a subset of SGML. XML retains all the “good points” of SGML, and it is simpler to use. As a result of creating a simpler version of SGML, a broader developer target was reached. Along with an easier-to-use SGML, the Web is everywhere, and XML was streamlined for Web delivery, hence the XML buzz.

As of October 2000, the W3C recommendation for XML version 1.0 Second Edition was published by the XML Core Working Group. (These guys are responsible for maintaining and reporting on updates, errata, and new submissions on XML.) Currently, they are working with the XML Syntax, XML Fragment, and XML Information Set Working Groups. To be up-to-date on the latest XML recommendations and updates, keep an eye on http://www.w3.org and http://www.xml.org.

So why is XML important to me? Well, for starters, common data formats sure make life easier. In the early ‘90s, I worked for a large data processing firm in Michigan. The whole purpose of my existence was to write COBOL programs that converted data from one format to another. We had our defined format, but all of the companies that sent us their data had their own formats. So I would receive a magnetic tape from a bank or brokerage firm, print out a dump of the first 20 records, and start figuring out how I was going to get it into our format for printing. This was a real pain in the neck. No matter how hard we tried, we could never get all of our customers to stick to a common f ormat. As I look back, if we had everyone sending the data in XML, my life would have been much easier. The bottom line is a common way of describing the data. If Customer X would send me their data, a schema, and some processing instructions, I could write a one-stop application that reads the XML and outputs it to my format without reinventing the wheel every time I received new data. That is the beauty of XML: data that describes itself.




Microsoft SQL Server 2005. The Complete Reference
Microsoft SQL Server 2005: The Complete Reference: Full Coverage of all New and Improved Features
ISBN: 0072261528
EAN: 2147483647
Year: 2006
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net