Blog de Francisco Velázquez

otro blog personal

Posts Tagged ‘deserialize

Deserializar en C# ignorando DTD

leave a comment »

        public static object Deserialize(System.Type type, string data)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(type);
            TextReader textReader = new StringReader(data);
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.ProhibitDtd = false;
            settings.XmlResolver = null;
            XmlReader xmlReader = XmlTextReader.Create(textReader, settings);
            return xmlSerializer.Deserialize(xmlReader);
        }

Written by fravelgue

June 8, 2011 at 9:48 am

Posted in development

Tagged with , , ,