Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 90,878 times

Contents

Related Categories

Reading, Storing and Transforming XML Data in .NET - Introduction

DMarko1

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

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 desktop applications. Till now Jimmy has authored nearly two dozen .NET articles, published on Dot Net Junkies, 4 Guys From Rolla, Sitepoint, MSDN Academic Alliance, Developers.NET, The Official Microsoft ASP.NET Site, and here on Developer Fusion, covering various unique and advanced techniques on .NET.

Comments

  • Posted by DMarko1 on 23 Mar 2005


    Hey Kurt,

    The xsl file is the xml transformation file which parses the xml into more readable html.

  • xsl

    Posted by kurtos on 07 Dec 2004

    i might be very slow here, but what part of the code here are supposed to be used in the pubs.xsl file? yes, I am a newbie :-)

    Regards,
    Kurt
    Norway

  • Posted by James Crowley on 18 Jan 2004

    Thanks - I'll check that and edit the article to fix it :)

  • Coding comment

    Posted by resalem on 12 Nov 2003

    Very good example, simple but contains a lot of information. Only one part I had to modify, in the XSL I had to change the criteria for the select from "PubsList/Pubs" to "PubsList/Table" as the child...