Esempio n. 1
0
        public void ReadAttribute(SimpleAttributeAttribute attribute, object reader,
                                  object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            object value = ReadSimpleValue(reader, receiver, settings, info, attribute.AutoTrim);

            SerializerUtil.CheckRequiredAttribute(attribute, receiver, info,
                                                  value.ConvertToString());
        }
Esempio n. 2
0
        public void ReadAttribute(SimpleAttributeAttribute attribute, object reader,
                                  object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XElement current = XElementData.GetCurrent(reader);

            XName      name  = info.QName.ToXName();
            XAttribute attr  = current.Attribute(name);
            string     value = attr == null ? null : attr.Value;

            SerializerUtil.CheckRequiredAttribute(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, attribute.AutoTrim);
        }
Esempio n. 3
0
        public void ReadAttribute(SimpleAttributeAttribute attribute, object reader,
                                  object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XmlReader xml = reader.Convert <XmlReader>();

            string localName = info.LocalName;
            string value     = null;

            switch (attribute.NamespaceType)
            {
            case NamespaceType.None:
                value = xml.GetAttribute(localName);
                break;

            case NamespaceType.Toolkit:
            case NamespaceType.Namespace:
                value = xml.GetAttribute(localName, attribute.NamespaceUri);
                break;
            }

            SerializerUtil.CheckRequiredAttribute(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, attribute.AutoTrim);
        }