PDA

View Full Version : XML file layout problems when saving


lee2006
19-04-2007, 12:58 PM
Hi there all
Still having problems with my XML files
I have an XML file that is updated froman asp.net web form using VB
The problem I am having is that the XML file is layed out as the example bellow

<system>
<node1>
<content>
Text Here
</content>
</node1>
</system>

I Call th xml file into an XMLDataDocument, update it and then save it back using

Sxml.PreserveWhitespace = True
Dim wrtr As XmlTextWriter = New XmlTextWriter("C:\test.xml", Encoding.Unicode)
Sxml.WriteTo(wrtr)
wrtr.Close()

This does udate the exsisting xml but it messes the layout of the xml file up for example the xml then looks similar as follows

<system><node1>
<content>
Text Here</content>
</node1></system>

it no longer has a tree structure, it still work when I import it but as my actual xml is rather large it is hard to view it for development
Anyone have any ideas I am new to XML but have learnt alot but all tutorials seem to assume that the layout does not get changed

Thanks
Anymore info just ask

Lee

lee2006
19-04-2007, 02:52 PM
Hi there all
Couldnt wotk this out so i just used the vb regex function to remove all ectra spaces from text so it all fits on one line, problem solved
Thanks
Lee