Link to home
Create AccountLog in
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.
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ITApprendista
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.