Reading, Storing and Transforming XML Data in .NET

Introduction

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:

  1. How to connect to a database and query it
  2. Writing or storing our search results to a local XML file
  3. Utilize the File System Object for some conditional testing
  4. Read our XML file from our local drive, transform and present it via XSL into our XML Web Control
  5. Lastly, we'll also use our performed XML document as a datasource and demonstrate the ease of binding a Datagrid Control with it

You might also like...

Comments

About the author

Dimitrios Markatos

Dimitrios Markatos United States

Dimitrios, or Jimmy as his friends call him, is a .NET developer/architect who specializes in Microsoft Technologies for creating high-performance and scalable data-driven enterprise Web and des...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor