XML encode method?

  • Thread starter Thread starter Sosh
  • Start date Start date
S

Sosh

Hi,

I was wondering if there is a method in the XML classes that allows
you to encode a string so it is safe to stick in an XML file? I would
have thought so, but can't find it. Please tell me I don't have to do
a replace for each of the dissallowed characters!!

Thanks
 
Sosh said:
I was wondering if there is a method in the XML classes that allows
you to encode a string so it is safe to stick in an XML file? I would
have thought so, but can't find it. Please tell me I don't have to do
a replace for each of the dissallowed characters!!

XmlTextWriter has plenty of methods to create well-formed XML.
 
XmlTextWriter has plenty of methods to create well-formed XML.
And if you really don't want to use anything from .NET and want do do your
own, there are only 2 characters that are not ok: '<' and '&'
 
Back
Top