Esempio n. 1
0
        public void ReadXml(XmlReader reader)
        {
            try
            {
                // Iniciamos la variable
                this._valoresPrensa = new Dictionary <string, TagValue>();

                reader.Read();
                reader.ReadStartElement("dictionary");
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    string strJson = reader.ReadElementString("item");

                    TagValue result = Newtonsoft.Json.JsonConvert.DeserializeObject <TagValue>(strJson, new Newtonsoft.Json.JsonSerializerSettings
                    {
                        TypeNameHandling = Newtonsoft.Json.TypeNameHandling.All
                    });

                    reader.MoveToContent();

                    // Agregamos el valor
                    this._valoresPrensa.Add(result.ToKey(), result);
                }
                reader.ReadEndElement();
            }
            catch (Exception er)
            {
                log.Error("ReadXml()", er);
            }
        }