Example #1
0
        public void ReadTextContent(TextContentAttribute attribute, object reader,
                                    object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            object value = ReadSimpleValue(reader, receiver, settings, info, attribute.AutoTrim);

            SerializerUtil.CheckRequiredContent(attribute, receiver, info,
                                                value.ConvertToString());
        }
Example #2
0
        public void ReadComplexContent(ComplexContentAttribute attribute, object reader,
                                       object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XElement current = XElementData.GetCurrent(reader);

            string value = current.HasElements ? current.FirstNode.ToString() : null;

            SerializerUtil.CheckRequiredContent(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, false);
        }
Example #3
0
        public void ReadTextContent(TextContentAttribute attribute, object reader,
                                    object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XElement current = XElementData.GetCurrent(reader);

            string value = current.Value;

            SerializerUtil.CheckRequiredContent(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, attribute.AutoTrim);
        }
Example #4
0
        public void ReadTextContent(TextContentAttribute attribute, object reader,
                                    object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XmlReader xml = reader.Convert <XmlReader>();

            string value = ReadString(xml);

            SerializerUtil.CheckRequiredContent(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, attribute.AutoTrim);
        }
Example #5
0
        public void ReadComplexContent(ComplexContentAttribute attribute, object reader,
                                       object receiver, ReadSettings settings, ObjectPropertyInfo info, object serializerData)
        {
            XmlReader xml = reader.Convert <XmlReader>();

            TkDebug.Assert(xml.NodeType == XmlNodeType.Element, string.Format(ObjectUtil.SysCulture,
                                                                              "ComplexContent初始要求XmlReader在Element节点上,当前状态是{0},位置不对", xml.NodeType), this);
            QName  name  = QName.Get(xml);
            string value = ReadComplexContent(xml, name);

            SerializerUtil.CheckRequiredContent(attribute, receiver, info, value);
            SerializerUtil.SetObjectValue(receiver, settings, info, value, false);
        }