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 4004898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:19:44+00:00 2026-05-20T08:19:44+00:00

I am building an XML string programatically using the XmlWriter … sb = New

  • 0

I am building an XML string programatically using the XmlWriter …

sb = New StringBuilder()
writer = XmlWriter.Create(sb)

writer.WriteStartDocument()
writer.WriteStartElement("root")

writer.WriteStartElement("element1")
writer.WriteAttributeString("myattribute", "myvalue")
writer.WriteEndElement()

writer.WriteEndElement()
writer.WriteEndDocument()

writer.Flush()

myTextBox.text = "<pre>" & Return sb.ToString() & "</pre>"

I want to be able to output the XML to a TextBox control on a ASP.NET webform. When I do output the XML I don’t get any line breaks or indentation in the XML. The XmlWriter does not seem to have any properties to set formatting. Is there anyway to retain formatting and indentation? Thank you.

  • 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-20T08:19:45+00:00Added an answer on May 20, 2026 at 8:19 am

    Use a XmlWriterSettings class instance to specify the use of indentations and line breaks and then pass it into the xmlWriter’s Create method. See the documentation here.

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

Sidebar

Related Questions

When building XML in PHP, is it quicker to build a string, then echo
I'm currently using Fusioncharts Free in my project which requires XML to be in
I was wondering: is there a way to create HTML files programmatically in C#
I've got a requirement to pass parameters as Xml to my stored procedures. I
I am building a single HTML page for use in a touch-screen kiosk. I
I have a large spreadsheet in Excel 2007 OpenXML format that I want to
This is what i'm trying to achieve: Use a TextView in a TabWidget (i.e.
I'm looping through a ResultSet in Java; which for testing purposes is returning about
In the thread What’s your favorite programmer ignorance pet peeve? , the following answer
I'm writing a web interface to MySQL that executes a couple queries and returns

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.