How to set xmlns when serializing object in c#
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-04-02T15:08:14Z
Indexed on
2010/04/02
15:13 UTC
Read the original article
Hit count: 253
I am serializing an object in my ASP.net MVC program to an xml string like this;
StringWriter sw = new StringWriter();
XmlSerializer s = new XmlSerializer(typeof(mytype));
s.Serialize(sw, myData);
Now this give me this as the first 2 lines;
<?xml version="1.0" encoding="utf-16"?>
<GetCustomerName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
my question is, How can I change the xmlns and the encoding type, when serializing?
Thanks
© Stack Overflow or respective owner