D
Dima Maltsev
Hi All,
I would like to get rid of the following attributes when I
serialize a class into an XML
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
This is not a problem when you are in charge of creating
an XmlSerializer object. All you need to do is to add an
empty XmlSerializerNamespaces collection. Something like
this:
TestClass obj;
XmlWriter writer;
XmlSerializer xs = new XmlSerializer( typeof( TestClass ));
XmlSerializerNamespaces namespaces =
new XmlSerializerNamespaces();
namespaces.Add( "", "" );
xs.Serialize( writer, obj, namespaces );
However, when you implement a Web Service method, you
don't have access to XmlSerializer object.
I am wondering how I can suppress the xmlns:xsd and
xmlns:xsi xml namespaces serialization in this case?
Thank you,
Dima Maltsev
I would like to get rid of the following attributes when I
serialize a class into an XML
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
This is not a problem when you are in charge of creating
an XmlSerializer object. All you need to do is to add an
empty XmlSerializerNamespaces collection. Something like
this:
TestClass obj;
XmlWriter writer;
XmlSerializer xs = new XmlSerializer( typeof( TestClass ));
XmlSerializerNamespaces namespaces =
new XmlSerializerNamespaces();
namespaces.Add( "", "" );
xs.Serialize( writer, obj, namespaces );
However, when you implement a Web Service method, you
don't have access to XmlSerializer object.
I am wondering how I can suppress the xmlns:xsd and
xmlns:xsi xml namespaces serialization in this case?
Thank you,
Dima Maltsev