tags:

views:

76

answers:

1

I have a block of XML in a database which is easy enough to pull out using ASP.NET MVC, however I would like to access and modify the XML in an way more consistent with class instances. Is there a way to get the MVC (or any other model) to generate a data access (or perhaps Entity) class set from the DB-stored XML?

If the above is rather obtuse, the question could be summarised as; What method would you use to best access and modify XML stored in a database from an ASP.NET MVC application?

Thanks,

Matt.

A: 

The method I went with in the end was simply to use LINQ2SQL to get the data from the SQL2005 DB and then pass the field value into XElement.Parse() to get an XML object I can easily work with. Manipulating the XML was the done using the information gained from helpful overflowers here:

http://stackoverflow.com/questions/2131061/how-do-i-insert-an-element-into-xml-using-linq

http://stackoverflow.com/questions/2454390/how-to-add-attributes-to-an-element-using-linq-c

http://stackoverflow.com/questions/2208844/how-to-sort-xml-in-linq-c-by-an-attribute-value-also-mvc

Matt W