public object Read(XmlNode node)
        {
            NetReflector.CheckNull(node, "node", typeof(XmlNode));
            IXmlSerialiser serialiser = table[node.Name];

            if (serialiser == null)
            {
                throw new NetReflectorException(string.Format("No loaded type is marked up with a ReflectorType attribute that matches the Xml node ({0}).  Xml Source: {1}", node.Name, node.OuterXml));
            }
            return(serialiser.Read(node, table));
        }
        public void Write(object target)
        {
            NetReflector.CheckNull(target, "target", typeof(object));

            ReflectorTypeAttribute attribute = ReflectorTypeAttribute.GetAttribute(target);

            if (attribute == null)
            {
                throw new NetReflectorException(string.Format("Cannot serialise the object.  Target object type ({0}) is not marked with a ReflectorType attribute.", target.GetType()));
            }
            attribute.Write(writer, target);
        }
 public void Read(XmlNode node, object instance)
 {
     NetReflector.CheckNull(node, "node", typeof(XmlNode));
     NetReflector.CheckNull(instance, "instance", typeof(object));
     new XmlTypeSerialiser(instance.GetType(), new ReflectorTypeAttribute(instance.GetType().Name)).ReadMembers(node, instance, table);
 }
 public void Read(XmlReader reader, object instance)
 {
     NetReflector.CheckNull(reader, "reader", typeof(XmlReader));
     Read(XmlUtil.ReadNode(reader), instance);
 }
 public void Read(TextReader reader, object instance)
 {
     NetReflector.CheckNull(reader, "reader", typeof(TextReader));
     Read(new XmlTextReader(reader), instance);
 }
 public void Read(string xml, object instance)
 {
     NetReflector.CheckNull(xml, "xml", typeof(string));
     Read(new StringReader(xml), instance);
 }
 public object Read(XmlReader reader)
 {
     NetReflector.CheckNull(reader, "reader", typeof(XmlReader));
     return(Read(XmlUtil.ReadNode(reader)));
 }
 public object Read(TextReader reader)
 {
     NetReflector.CheckNull(reader, "reader", typeof(TextReader));
     return(Read(new XmlTextReader(reader)));
 }
 public NetReflectorWriter(XmlWriter writer)
 {
     NetReflector.CheckNull(writer, "writer", typeof(XmlWriter));
     this.writer = writer;
 }
 public NetReflectorWriter(TextWriter writer)
 {
     NetReflector.CheckNull(writer, "writer", typeof(TextWriter));
     this.writer = new XmlTextWriter(writer);
 }