Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 723167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:04:35+00:00 2026-05-14T06:04:35+00:00

I am displaying charts that load the data asynchronously because the searches are the

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:04:35+00:00Added an answer on May 14, 2026 at 6:04 am

    Write a custom action result:

    public class XmlActionResult : ActionResult
    {
        public XmlActionResult(object data)
        {
            Data = data;
        }
    
        public object Data { get; private set; }
    
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
    
            // TODO: Use your preferred xml serializer 
            // to serialize the model to the response stream :
            // context.HttpContext.Response.OutputStream
        }
    }
    

    And in your controller action:

    public ActionResult Index() 
    {
        var model = _repository.GetModel();
        return new XmlActionResult(model);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am displaying a scrolled data table in a web page. This table has
http://www.asp.net/webmatrix/tutorials/7-displaying-data-in-a-chart goes over how to create simple charts and they are working, but I
I am displaying a texture that I want to manipulate without out affecting the
I've got about 5000-7000 objects in my core data store that I want to
Im trying to create some chart images without ever displaying those charts on the
One web application of ours requires a feature of displaying charts in it. Basically
I have a webpage that requires login. Once a user has logged in I
I am displaying a list of data in the following manner; Surname Forename Email
I'm displaying some data as a TreeView. How can I detect a click on
In my app I'm displaying 10 charts (charts are from dygraphs .) to monitor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.