/// <summary>Initializes a new instance with default values</summary> public RssItem () { Enclosure = new RssEnclosure(); Guid = new RssGuid(); Source = new RssSource(); this.PubDate = DateTime.Now; }
/// <summary>Initializes a new instance</summary> public RssItem(XmlReader xmlTextReader) : this() { if (xmlTextReader.IsEmptyElement) return; // Debug.Assert(!xmlTextReader.IsEmptyElement); bool supressRead = false; // fill new item with the provided data while (!(xmlTextReader.Name == "item" && xmlTextReader.NodeType == XmlNodeType.EndElement)) { // Continue read if (!supressRead) xmlTextReader.Read(); xmlTextReader.MoveToContent(); // supressRead = false; if (xmlTextReader.NodeType != System.Xml.XmlNodeType.Element) continue; // find related property by name if (xmlTextReader.Name == "enclosure") { if (!xmlTextReader.HasAttributes) continue; Enclosure = new RssEnclosure(xmlTextReader); } else if (xmlTextReader.Name == "guid") { supressRead = !xmlTextReader.IsEmptyElement; Guid = new RssGuid(xmlTextReader); } else if (xmlTextReader.Name == "source") { supressRead = !xmlTextReader.IsEmptyElement; Source = new RssSource(xmlTextReader); } else if (!xmlTextReader.IsEmptyElement) { supressRead = XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader); } } }