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

  • SEARCH
  • Home
  • 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 7416829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:34:37+00:00 2026-05-29T07:34:37+00:00

I have a string in a ASP.NET MVC details page with the value of

  • 0

I have a string in a ASP.NET MVC details page with the value of

<this><is sample = "attribute"><xml><power>!!!</power></xml><oh><yeah></yeah></oh></is></this>.

I want it to display as follows:

<this>
  <is sample = "attribute">
    <xml>
       <power> !!! </power>
    </xml>
    <oh>
       <yeah>
       </yeah>
    <oh>
  </is>
</this>

Things I have tried:

1: How to Display Formatted XML – best answer and richards answer

2: xmlwriter.writeraw();

3: basic linq-to-xml (i’m not very good with this)

EDIT: I am displaying the string as follows and was wondering if this may have something to do with it:

<%: *formatted string goes here* %>
  • 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-29T07:34:38+00:00Added an answer on May 29, 2026 at 7:34 am

    I was doing it in this way:

    protected string FormatXml(XmlNode xmlNode)
    {        
        StringBuilder builder = new StringBuilder();
    
        // We will use stringWriter to push the formated xml into our StringBuilder bob.
        using (StringWriter stringWriter = new StringWriter(builder))
        {
            // We will use the Formatting of our xmlTextWriter to provide our indentation.
            using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter))
            {
                xmlTextWriter.Formatting = Formatting.Indented;
                xmlNode.WriteTo(xmlTextWriter);
            }
        }
    
        return builder.ToString();
    }
    

    http://forums.asp.net/t/1145533.aspx/1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

asp.net mvc 2 I have this action in Identity controller public ActionResult Details(string id,
In code-behind of an ASP.NET page I have this method: public string TestFunc() {
I have an ASP.Net MVC page where I want to use AJAX to update
In my asp.net-mvc website I have a field that usually has a string (from
In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I
I have any ASP.NET control. I want the HTML string how to do I
I am using asp.net mvc 2.0(default binding model) and I have this problem. I
I have an ASP.NET MVC Page that i have to display the fields in
I have the following code inside my asp.net-mvc project: private string GenerateEmail(RequestContext requestContext) {
guy, i have a page in my asp.net mvc website. the Route configuration: public

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.