Showing Tag: "xml" (Show all posts)

Serialize an object in c# with XmlSerializer by removing xml schema elements.

Posted by jineesh uvantavida on Tuesday, November 14, 2017, In : c# 
Serialize an object in c# with XmlSerializer by removing xml schema elements such as xmlns:xsi

        string content =String.Empty;
XmlDocument xmlDoc = new XmlDocument();
        XmlSerializer xmlSerializer = new XmlSerializer(obj.GetType());
        using (MemoryStream xmlStream = new MemoryStream())
        {
            var ns = new XmlSerializerNamespaces();
            ns.Add("", "");
            xmlSerializer.Serialize(xmlStream, obj, ns);
            xmlStream.Position = 0;
            //Load...

Continue reading ...
 
 

Translate This Page

 


Make a free website with Yola