XmlSerializer implements serialization of CDATA

     [XmlIgnore]
        public string GuestRemarks { get; set; }

        [XmlElement("GuestRemarks")]
        public XmlNode[] Nodes
        {
            get
            {
                var dom = new XmlDocument();
                return new XmlNode[] {dom.CreateCDataSection(this.GuestRemarks)};
            }
            set
            {
                if (value == null)
                {
                    this.GuestRemarks = null;
                    return;
                }

                if (value.Length != 1)
                    throw new InvalidOperationException("Invalid array.");
                var content = value[0];
                if (null == content)
                    throw new InvalidOperationException("Node is null.");
                this.GuestRemarks = content.Value;
            }
        }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325231012&siteId=291194637