Saturday, April 01, 2006

Asp.Net 2.0 XML back-end

In most cases developers use databases for the site back-end. However for small sites or sites where most content is not needed database you can use XML.

In Asp.Net 2.0 you can use XmlDataSource with many databound controls like FormView or . This provides easy way to show various data.

For example I can describe one of the strategies what I use. This is the Sources folder of my site. On the start page it have list of all sources. They have title, description, screen url, details url and download url. For details page I need the same list of the data plus long description (article). This means that many of the identical data stored in the different places of the site. Of course I want to have one place for this information. How I was resolving this? I was added sources.xml file in the App_Data directory that has all this data. Now for the start page I use DataList binded to the XmlDataSource that retrieve information from the sources.xml. For details page I use FormView with XmlDataSource that retrieve information from the same xml file, however I use XPath that filters this file to show only appropriate information. Clear?

I think this technology is useful for many places. However it has big issue... XmlDataSource is read-only.

P.S. Possible that in few days I will post UpdatableXmlDataSource. But of course I can not promise something.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home