468,554 Members | 1,332 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

How to normalize single and double quotes using XmlSerializer?

When using XmlSerializer, I notice that it does not normalize the
single quote and double quote characters, i.e. does not change ' to
' and " to &quot. However, it does normalize other characters,
like changing ampersand to &

Here is my code:
---- start of code --------

MyClass *myClass = MyClass() ;
XmlSerializer *xs = new XmlSerializer( __typeof( MyClass ) ) ;
StringWriter *sw = new StringWriter() ;

xs->Serialize( sw, myClass ) ;

String xmlResult = sw->ToString() ;

---- end of code --------

Is this a inherent property of XmlSerializer that cannot be changed?
If the answer is yes, is there other .Net classes that will provide
normalization for single and double quotes? Thanks.
Nov 12 '05 #1
1 5190
Daniel Lim wrote:
When using XmlSerializer, I notice that it does not normalize the
single quote and double quote characters, i.e. does not change ' to
' and " to &quot. However, it does normalize other characters,
like changing ampersand to &


That's because only & and < characters *must* be escaped in XML.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by sinister | last post: by
11 posts views Thread by Jakanapes | last post: by
4 posts views Thread by sankofa | last post: by
5 posts views Thread by Joel | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.