Sagaert Johan wrote:
Is there some kind of method to convert strings containing " < etc to
some form that it is allowed inside XML tags ?
Use XmlWriter to create your XML, it does the necessary escaping for
you. If you only want to create a text then use XmlWriterSettings with
ConformanceLevel.Fragment e.g.
XmlWriterSettings settings = new XmlWriterSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
StringWriter writer = new StringWriter();
using (XmlWriter xmlWriter = XmlWriter.Create(writer, settings))
{
xmlWriter.WriteString("a < b && b < a");
}
Console.WriteLine(writer.ToString());
writes "a < b && b < a".
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/