I was making some changes to a client's website recently and found static repeated HTML in quite a few places. Their internal developer had put something together than ended up going live!
I decided to create put the HTML in a SQL DB and use LINQ to SQL to retieve the content on demand. All ready to go live and website being hosted somewhere else on their network with slow access to their DB server. No problem, export the content as XML and use LINQ to XML to retrieve.
I ended up getting the content data into a DataTable with a table name of "Content" and then calling the data table's WriteXML method to output as XML. The format was:
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<Content>
<PageName>HOME</PageName>
<Text>blah</Text>
</Content>
</DocumentElement>
Then you can write a function that contains your LINQ to XML:
var query = (from c in m_Content.Elements("DocumentElement").Elements("Content")where c.Element("PageName").Value == "HOME"
select c).FirstOrDefault();
return HttpUtility.HtmlDecode(query.Element("Text").Value);
Very cool! And much easier that typed data sets.