Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to ident/align closing tag with opening tag

$
0
0

Hi,

I am developping a small utility to make changes to vs2005/2008 project files (vcproj) and I would like 
to know how can I serialize xml with the same indentation (the closing tag is aligned with the opening one):

<Tool
	Name="VCPreBuildEventTool"
/>


I have used the following settings but I don't managed to align the closing tag :

XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = encoding;
//settings.
settings.Indent = true;
settings.IndentChars = "\t";
settings.NewLineChars = "\r\n";
settings.WriteEndDocumentOnClose = false;
settings.NewLineHandling = NewLineHandling.Replace;
settings.NewLineOnAttributes = true;
settings.ConformanceLevel = ConformanceLevel.Document;
settings.OmitXmlDeclaration = omitXmlDeclaration;

And here is the result :

<Tool
	Name="VCPreBuildEventTool" />

Is it possible to get the same indentation as vs2005 project file ?

I need this to be able to debug my generator and to compare the two files easily. 


Viewing all articles
Browse latest Browse all 935

Trending Articles



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