> I have a URL like "https://aaaa.aaa/bbb/bbbb/ccc?dd=44&ee=55%c2066
>
> And I wan to put it in an XML configuration file. Trying to use
> HttpUtility to HTML encode it is not enough, I need to "XML Encode"
> it, how can I do that?
If you want to put it in an XML file, I'd use the XML APIs to create
the XML file in the first place - they will usually take care of all
this for you.

Signature
Jon Skeet - <skeet@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Mike Urquiola - 27 May 2008 15:13 GMT
>> I have a URL like "https://aaaa.aaa/bbb/bbbb/ccc?dd=44&ee=55%c2066
>>
[quoted text clipped - 5 lines]
> the XML file in the first place - they will usually take care of all
> this for you.
Or you can put whatever you want in a CData section.
<![CDATA[https://aaaa.aaa/bbb/bbbb/ccc?dd=44&ee=55%c2066]]>
Jon Skeet [C# MVP] - 27 May 2008 19:28 GMT
> >> I have a URL like "https://aaaa.aaa/bbb/bbbb/ccc?dd=44&ee=55%c2066
> >>
[quoted text clipped - 8 lines]
> Or you can put whatever you want in a CData section.
> <![CDATA[https://aaaa.aaa/bbb/bbbb/ccc?dd=44&ee=55%c2066]]>
Well, so long as your data doesn't contain ]]>
It makes it harder to read the strings which don't need it, however.
I'm also not sure whether or not it works for attributes. I think it's
generally simpler to use a proper XML API whose job is to hide things
like this.

Signature
Jon Skeet - <skeet@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com