c# - How to get rid of the xmlns when using xml serialization -
i don't want following appended root element
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">
what should when using xml serialization.
by using serialize method:
public class foo { } class program { static void main() { var foo = new foo(); var serializer = new xmlserializer(foo.gettype()); var ns = new xmlserializernamespaces(); ns.add(string.empty, string.empty); serializer.serialize(console.out, foo, ns); } }
notice last argument (ns
).
Comments
Post a Comment