c# - Get pure XML from Object -
i have following code converts object xml , working fine.
public static string convertobjecttoxml(object obj) { string xmlizedstring = null; memorystream memorystream = new memorystream(); xmlserializer xs = null; if (obj derivedclass2) { xs = new xmlserializer(typeof(derivedclass2)); } textwriter w = new stringwriter(); //this.s = new xmlserializer(this.type); xs.serialize(w, notoficationorder); w.flush(); //return w; xmlizedstring = w.tostring(); w.close(); return xmlizedstring.trim(); }
and gives following output
<?xml version="1.0" encoding="utf-16"?>* <obj xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <list> <!--...--> </list> </obj>
but not want xml depicts xml namespace xd etc. need pure object output of below
<obj> <list> <!--...--> </list> </obj>
thanks
ocean
how remove xmln:xsi , xmlns:xsd xml dictionary serialization
this vb .net idea same.
Comments
Post a Comment