I am displaying charts that load the data asynchronously because the searches are the work to fetch the data is quite heavy. The data has to be return as XML to make the chart library happy.
My ActionMethods return a ContentResult with the type set as text/xml. I build my Xml using Linq to XML and call ToString. This works fine but it's not ideal to test.
I have another idea to achieve this which would be to return a view that builds my XML using the XSLT View engine.
I am curious and I always try to do the things "the right way". So how are you guys handling such scenarios?
Do you implement a different ViewEngine (like xslt) to build your XML or do you Build your XML inside your controller (Or the service that serves your controller)?
EDIT :
Since I need this to pass the data to a Charting Library, I have to follow their xml structure. Their notation is not the way i want to build my model classes at all. That's why I build the XML myself using Linq to XML and wonder if a template would be better.
Simple serialization is not what I look for