ASP.NET MVC does not impose restrictions on your responses. Your templates can be any form of XML, XHTML, HTML, JSON, etc. that you need. The question then comes how do you want to form the XML? You have two options:
- System.Xml.Serialization.XmlSerializer--XML generated automatically from model, convenient but limited control
- Using the same template aspcx approach you would for HTML files--most control, slightly less convenient
My guess is that you will want to use the second option. The second option guarantees the output of your XML will be able to comply with whatever standard you want. In that case, your controller has one responsibility other than responding with
return View(model);. That is setting the response content type correctly. The response content type should be
text/xml (mime type for XML documents).
Your template master will handle all the header information (xml declarations, namespace declarations, etc.), and the
<asp:ContentPlaceHolder ID="MainContent" runat="server" /> would call your specific view. Do note that every template needs to be valid XML for this to work. You'll have to escape certain embedded content to make sure of it.