User entered data in XML

  • Thread starter Thread starter nobody
  • Start date Start date
N

nobody

I'm writing data the user enters out to an XML file (using DataSet.WriteXML;
DataSet is a typed DataSet created from an XML Schema). The problem I'm
having is the user can (and needs to) enter characters like &, < and >. Is
there some .NET function (maybe something in System.Xml) that will take a
string and format it for output to an xml file (such as change all &'s to
&amp;, etc.)? I'd hate to have to do String.Replace("&",
"&amp;").Replace(...).Replace(...) all the fields manually, but if that's my
only alternative...
 
Nevermind, I just realized that DataSet.WriteXml(...) does the conversions
from & to &amp;, etc. already. I must have manualy edited the .xml in
notepad and added the &. Doh!
 
Back
Top