Avatar of ITApprendista
ITApprendista
 asked on

Removing indentation from XML or setting it so that it does not automatically indent

I'm writing a custom program that edits xml files which are settings files for a program we use.  I've figured out how to change all the nodes & use XPath to locate the ones I need to edit.

Basically there is a method I wrote which creates a new XML (Configuration) file based off a template.  The problem is...the program by default uses XML files that have no indentation, no returns, no tabs.  So, when I open the XML template then save it as a new job I get a fully indented & formatted XML file.  All the info is correct but when you open this indented and formatted XML file in the program the program doesn't like it.

So....is there any way I can open and edit an XML file but NOT automatically indent it?

I'm programming all this with VB.net and using the DOM document properties to edit the XML files.
.NET Programming

Avatar of undefined
Last Comment
ITApprendista

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Snarf0001

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ITApprendista

ASKER
This works except:  For some reason the first line the template is
<?xml version="1.0"?>
But after editing it becomes
<?xml
version="1.0"?> which is enough to throw the whole thing off.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes