Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

add indent spaces to xml nodes with ms IXMLDOM

$
0
0

Hi All,

  Currently I was update a xml file with IXMLDOM, after add nodes to xml file, we found the new added node was written in one line always.  this make it hard to find the differences with merge tools.

  and after we try to add text node to the xml to format it, it works unless we added nested nodes, it looks like:

 
<RootNode><ChildNodes><Child>value</Child></ChildNodes></RootNode>

Ugly, huh

And, when we set node's type with IXMLDOMNode::put_dataType it makes the node like:

<Name xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string" Encoding="Standard" >Connections</Name>

but, the original nodes was: 

<Name dt:dt="string" Encoding="Standard" xmlns:dt="urn:schemas-microsoft-com:datatypes">Connections</Name>

Also, it will not affect the its function, just cause extra efforts to merge the results.

So my questions:

   1. is there any built-in functions that can be used to format the xml file to a indented version. 

   2. how to adjust the sequences of attributes of a node.

  

Thanks, 

Levi

PS: currently, I was working on Windows CE 6.0, and these issues met on desktop OS too.


   


One world, one dream


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>