开发者

Dealing with XML in ASP.NET MVC

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 p开发者_运维技巧erhaps 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?


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:

How do I insert an element into XML using Linq?

How to add attributes to an element using LINQ, C#?

How to sort XML in LINQ C# by an attribute value? Also MVC

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜