EDN Admin
Well-known member
Hey, Guys!
Ive reached a problem with intending XmlDocument.
Heres my beautifying function:
public string Beautify(XmlDocument doc)
{<br/>
StringBuilder sb = new StringBuilder();<br/>
XmlWriterSettings settings = new XmlWriterSettings();<br/>
settings.Indent = true;<br/>
settings.IndentChars = "t";<br/>
settings.NewLineChars = "rn";<br/>
settings.NewLineHandling = NewLineHandling.Replace;<br/>
using (XmlWriter writer = XmlWriter.Create(sb, settings)) doc.Save(writer);<br/>
return sb.ToString();<br/>
}
after operating, it intends only first tag (<?xml version="1.0"?>)
All the other tags stay in one line.
Whats wrong?
View the full article
Ive reached a problem with intending XmlDocument.
Heres my beautifying function:
public string Beautify(XmlDocument doc)
{<br/>
StringBuilder sb = new StringBuilder();<br/>
XmlWriterSettings settings = new XmlWriterSettings();<br/>
settings.Indent = true;<br/>
settings.IndentChars = "t";<br/>
settings.NewLineChars = "rn";<br/>
settings.NewLineHandling = NewLineHandling.Replace;<br/>
using (XmlWriter writer = XmlWriter.Create(sb, settings)) doc.Save(writer);<br/>
return sb.ToString();<br/>
}
after operating, it intends only first tag (<?xml version="1.0"?>)
All the other tags stay in one line.
Whats wrong?
View the full article