Entradas

Mostrando las entradas etiquetadas como XML

Introducción a los servicios web RESTful (actualizado 17/09/2013)

REST - Actualizado 17/09/2013 ¿Qué es? REST (Representational State Transfer) define un set de principios arquitectónicos por los cuales se diseñan servicios web haciendo foco en los recursos del sistema, incluyendo cómo se accede al estado de dichos recursos y cómo se transfieren por HTTP hacia clientes escritos en diversos lenguajes.

[C#] Serializar y deserializar objetos en XML

En este post veremos como guardar un objeto c# a un archivo xml y como cargarlo. Código Serializador using System; using System.IO; using System.Text; using System.Xml; using System.Xml.Serialization; namespace Datos { public static class SerializadorXML { public static object Deserializar(XmlDocument xml, Type type) { XmlSerializer s = new XmlSerializer(type); string xmlString = xml.OuterXml.ToString(); byte[] buffer = ASCIIEncoding.UTF8.GetBytes(xmlString); MemoryStream ms = new MemoryStream(buffer); XmlReader reader = new XmlTextReader(ms); object o = null; try { o = s.Deserialize(reader); } finally { reader.Close(); } return o; } public static T Deserializar (XmlDocument xml) { return (T)Deserializar(xml, typeof(T)); } ...