XML encode method?

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
 
M

Martin Honnen

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.
 
M

Mihai N.

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 '&'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top