Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about xml-formatting

Read more about xml-formatting

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - xml-formatting

Format XmlDocument (indentation) without removing line breaks

I have an XML file that I want to modify (add new elements) and then save. The problem is that the file has empty lines that should not be deleted. This is what I'm currently doing: // loading documen...
test-img

tlz13

c#

xml

xmldocument

xml-formatting

Votes: 0

Answers: 1

Latest Answer

I'd generally suggest LINQ to XML is a far nicer API. You can insert the whitespace you need to keep the formatting you want. For example: var doc = XDocument.Load(inputFilePath, LoadOptions.PreserveW...
test-img

Charles Mager

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved