[Test]
public void Convert_xml_to_html()
{
string xml = @"<configuration>
...
<system.diagnostics>
<trace autoflush='true' />
<sources>
<source name='System.ServiceModel'
switchValue='Information, ActivityTracing'
propagateActivity='true'>
<listeners>
<add name='FuckingAwesomeWCFLogger'
type='System.Diagnostics.XmlWriterTraceListener'
initializeData='FuckingAwesomeWCF.log' />
</listeners>
</source>
</sources>
</system.diagnostics>
...
</configuration>";
Console.Out.WriteLine(xml.Replace("<", "<").Replace(">", ">").Replace("'", """).Replace("/", "/").Replace("=", "="));
}

1 comments:
Depending on what you need this for, there is also the System.Web.HttpUtility.HtmlEncode method available. I think it produces something slightly different than your implementation though...
Post a Comment