###################
Update: thanks to user2622016 I relized the ">" is valid .
Now , in my c# code I have a class that one of its fields has ">" as its value.
I want to serialize the class to xml WITHOUT the ">" being escaped to >
.
I am using xmlSerializer class. My code is:
memoryStream = new System.IO.MemoryStream();
System.Xml.XmlWriterSettings xmlWriterSettings = new System.Xml.XmlWriterSettings();
xmlWriterSettings.Encoding = encoding;
xmlWriterSettings.Indent = true;
System.Xml.XmlWriter xmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings);
Serializer.Serialize(xmlWriter, myObj);
any Idea How to achieve that without writing the entire XML using "writeRaw" (since i want the entire class to be serialized) ?
###################
is ">" a valid character in XML ?
simple answer is no . based on everything I know.. (also, Invalid Characters in XML )
but when I am trying to check with xml validation tools available online like: http://www.w3schools.com/xml/xml_validator.asp , http://www.xmlvalidation.com/
it says the following xml is valid:
<?xml version="1.0" encoding="utf-8"?>
<object>
<innerObj attrib="myAttrib">invalid char is > why valid</innerObj >
</object>
How is it possible ?
(Reason i am asking , I am trying to take this xml as a class in c# and serialize it . obviously it escapes ">" to ">"
. and I don't want it to happen ..
Any explanation about this "Valid invalid" Character and how to solve my serialization issue ? )
Thanks!!!