Unless you happened to be involved in some other career field, it would almost impossible to not realize that XML is steadily growing as a common data exchange format that can used be across any platform. As long as you conform to standard XML specifications, you can send your XML file anywhere, have it parsed or searched, and displayed as if it were perhaps on your local computer.
With .NET's arrival, reading data from a database, writing your results to an XML file, transforming it with an XSL stylesheet or even binding Web controls has become almost effortless, when compared to classic ASP. .NET offers developers many options with which they can manipulate and present data.
This article will illustrate a mixture of common .NET methods for formatting and presenting in a readable fashion any XML document you may encounter. The latest hype with XML Web services and even the .NET Framework itself relies on XML as its backbone, therefore this is no light matter. Furthermore, .NET offers numerous ways and XML objects for reading, writing and querying your XML. They primarily fall into three sections - Reading, Writing and Transforming XML, Storing and Manipulating your XML, and lastly Querying XML documents. In this article I'll demonstrate two of those. I'll use Net's more commonly used XML Document Object Model as part of the W3C DOM.
In this article, we will look at a few things:
- How to connect to a database and query it
- Writing or storing our search results to a local XML file
- Utilize the File System Object for some conditional testing
- Read our XML file from our local drive, transform and present it via XSL into our XML Web Control
- Lastly, we'll also use our performed XML document as a datasource and demonstrate the ease of binding a Datagrid Control with it