Chapter 13. XML in ASP.NET

   

Say whatever you're gonna say… I'll figure it out.

If you've been involved with web design and programming for more that a short time, you've seen several things come out that have been deemed "THE NEXT BIG THING" in web design. From little things like the dreaded "blink" tag (I'd like to kick the guy who created that in the shins) to DHTML being the great interface savior, to scalable vector graphics changing the way that graphical images will be delivered to browsers. Not to say that these things don't have their uses or place (except the blink tag, of course, which has no place in design), but they didn't reform the web like it was originally reported they would. And funny enough, scalable vector graphics are really images that are created through XML.

Now the term XML has been floating around for a few years and you've heard people state that "THIS IS BIG…IT'S REALLY BIG!!!" But you haven't seen any huge changes at all that are a result of XML. Let me assure you that they are here now and more changes are coming.

For instance, you may be using or have been hearing about XHTML. This is a strain of XML that is reshaping the direction that browser markup language is going. Go to http://www.w3c.org to find out more about this.

Chapter 10 discussed ADO.NET and how it delivers data from databases. XML is used in all the "behind the scenes" activities of ADO.NET. When data is passed back and forth and manipulated with ADO.NET, XML is the vehicle.

The current version of Microsoft SQL Server has an XML layer that enables you to retrieve data from the SQL Server in XML format. As a matter of fact, Microsoft has said that future versions of SQL Server will store all data in XML format.

Having given you these few examples, let me assure you that XML is here and here to stay in a BIG way. Although you've seen XML throughout this book in the Web.Config file, I just want to refresh your memory. XML (Extensible Markup Language) is an open standard language that allows the creation of self-describing, structured information in a standard text document.

XML can be used to describe any type of information you'd like to. The following is a simple example of using XML to describe the people that a fictional person named Bob knows.

bobspeople.xml
<?xml version="1.0"?>  <BobsPeople>      <Family>          <Wife>              <Name>Susie</Name>          </Wife>          <Children>              <Child>                  <Name>Betty</Name>                  <Gender>Girl</Gender>              </Child>              <Child>                  <Name>Sam</Name>                  <Gender>Boy</Gender>              </Child>          </Children>      </Family>      <Friends>          <Friend>              <Name>Ted</Name>          </Friend>          <Friend>              <Name>Frank</Name>          </Friend>      </Friends>  </BobsPeople> 

If you look at this file, you can see that Bob's wife's name is Susie. He has two children: a daughter named Betty and a son named Sam. He has two friends, Ted and Frank. This is all pretty self explanatory if you take the time to read the delimiter tags. This is the way XML works. It describes itself.

There is another document type called an XSL document, which is an Extensible Stylesheet Language Transformations stylesheet. This file is used as a template to format XML data. You'll see more on this shortly.

Now, what does this have to do with you or your use of ASP.NET, you ask? Plenty! ASP.NET gives you tools and server controls to do all kinds of stuff with XML data and XML documents.

Let me say that this one little chapter will hardly scratch the surface of XML and barely dent XML's relationship and use in ASP.NET. To master XML's uses within ASP.NET, I recommend a book titled XML and ASP.NET, by Kirk Evans, Ashwin Kamanna, and Joel Mueller, from New Riders publishing. That book provides a much more thorough overview of this subject.


   
Top


ASP. NET for Web Designers
ASP.NET for Web Designers
ISBN: 073571262X
EAN: 2147483647
Year: 2005
Pages: 94
Authors: Peter Ladka

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