ReadElementContentAsObject() public method

public ReadElementContentAsObject ( ) : object
return object
示例#1
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToElement();
            reader.ReadStartElement();
            Type instanceType = base.GetType().BaseType;

            while (reader.IsStartElement())
            {
                if (reader.HasAttributes)
                {
                    XmlNodeType nodeType = reader.NodeType;

                    Type t = typeof(FileProcessingJournalEntryData <>);
                    t = t.MakeGenericType(Type.GetType(reader.GetAttribute("type")));
                    string name = reader.GetAttribute("name");

                    var ser = XmlSerializerCache.GetOrAdd(t, name);

                    object obj = ser.Deserialize(reader.ReadSubtree());
                    reader.ReadEndElement();
                    this.EntryData.Add((FileProcessingJournalEntryDataBase)obj);
                }
                else
                {
                    PropertyInfo Prop = instanceType.GetProperty(reader.Name);
                    if (Prop != null)
                    {
                        var h = reader.ReadElementContentAsObject(Prop.Name, "");
                        Prop.SetValue(this, Convert.ChangeType(h, Prop.PropertyType), null);
                    }
                }
            }
        }
 public override object ReadElementContentAsObject()
 {
     CheckAsync();
     return(_coreReader.ReadElementContentAsObject());
 }
示例#3
0
 public virtual object ReadField(XmlReader xmlReader)
 {
     return xmlReader.ReadElementContentAsObject();
 }
示例#4
0
 public virtual void ReadXml(XmlReader reader)
 {
     Value = reader.ReadElementContentAsObject();
 }