Chapter 13: XML

Chapter 13

XML

In a few short years, XML has grown from an obscure specification into the world s de facto data language. XML stands for Extensible Markup Language. Whereas HTML is designed to express appearance, XML is designed to express raw information absent any implied notion about how the data should be rendered. It s a simple language that is entirely text based, making it particularly well suited to travel over text-based protocols such as HTTP, and that has no predefined tags as HTML does. XML provides the rules. You provide the rest.

XML finds several applications in business and, increasingly, in everyday life. It provides a common data format for companies that want to exchange documents. It s used by Web services to encode messages and data in a platform-independent manner. It s even used to build Web sites, where it serves as a tool for cleanly separating content from appearance.

There s little remarkable about XML in and of itself. What makes XML important is the fact that the computer industry has accepted it as a standard, and as such numerous tools are available for reading and writing XML. If someone hands you a large free-formatted text file containing thousands of records and your job is to get the records into a database, you ll probably end up writing a parser to extract the records from the file and write them to the database. If the text file is an XML file, your job is much simpler. You can use one of the many XML parsers already available to read the records. XML doesn t make your life easier because it s a great language. It makes your life easier because tools for reading, writing, and manipulating XML data are almost as common as word processors.

When it comes to handling XML, nothing rivals the .NET Framework class library (FCL) for ease of use. A few simple statements will read an entire XML file and write its contents to a database, or query a database and write out the results as XML. It s equally easy to perform XPath queries on XML documents or convert XML into HTML on the fly using XSL transformations.

This chapter is about the XML support in the FCL. A comprehensive treatment of the subject could easily fill 200 pages or more, so I ll attempt to strike a reasonable balance between detail and succinctness. In the pages that follow, you ll learn about the classes and namespaces that form the cornerstone for the FCL s XML support. Before we start slinging code, however, let s take a brief look at XML itself.



Programming Microsoft  .NET
Applied MicrosoftNET Framework Programming in Microsoft Visual BasicNET
ISBN: B000MUD834
EAN: N/A
Year: 2002
Pages: 101

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