preserveWhiteSpace

Hi All,

I am using MSXML6.0 to create XLM document files. With the preserveWhiteSpace, I was able to have an indented XML file looks like this:

<Server>
<Bindings>
<Binding>
<ListenAddress>0.0.0.0</ListenAddress>
<Port>12</Port></Binding></Bindings>

However, I want to have the document to be indented like this:

<Server>
<Bindings>
<Binding>
<ListenAddress>0.0.0.0

</ListenAddress>

<Port>12

</Port>

</Binding>

</Bindings>

How do I tell the MSXML to preserveWhiteSpace like that?

Thanks.

[711 byte] By [DavidN.] at [2007-12-24]
# 1

There is no setting on MSXML to achieve that described indentation. White space in element content is significant so the described indentation does not look like a good idea to me, any code consuming the XML then would need to strip away the white space to get e.g. the port number.

If you really want that indentation then you have to craft it yourself using DOM or XSLT to insert white space as needed.

MartinHonnen at 2007-10-8 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified