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 '&'
 
No, I don't really want to. But it doesn't look so bad when you put
it like that.
 

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

Similar Threads


Back
Top