2016-05-29 40 views
2

好吧,我有一些代碼應該改變配置文件中的值。使用製表符而不是XML中的空格縮進

 string xmlFile = "KeePass.config.xml"; 
     System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); 
     XmlWriterSettings settings = new XmlWriterSettings(); 
     settings.IndentChars = "\t"; 
     settings.Indent = true; 
     xmlDoc.Load(xmlFile); 
     xmlDoc.SelectSingleNode("Configuration/Application/LastUsedFile").InnerText = fileName; 
     xmlDoc.Save(xmlFile); 

的問題,這是它與縮進空格代替標籤和讀取配置文件需要看到標籤縮進XML程序的XML文件。任何幫助,將不勝感激。

回答

1

您是否試過

xmlDoc.PreserveWhitespace = true; 
相關問題