/// <summary> /// Reads a base feed based on the xml given in element /// </summary> /// <param name="feedXml"></param> /// <param name="xelement"></param> public BaseFeed(string feedXml, System.Xml.Linq.XElement xelement) : this() { this.OriginalDocument = feedXml; this.Title = xelement.GetValue("title"); this.Link = xelement.GetValue("link"); }
public static T GetEnumValue <T> (this System.Xml.Linq.XElement xElement, T Default) { try { if (xElement == null) { return(Default); } else { return((T)Enum.Parse(typeof(T), xElement.GetValue( ))); } } catch (FormatException) { return(Default); } }
/// <summary> /// Initializes a new instance of the <see cref="DublinCore"/> class. /// Reads a dublincore (dc:) element based on the xml given in element /// </summary> /// <param name="item">item element as xml</param> public DublinCore(System.Xml.Linq.XElement item) { this.Title = item.GetValue("dc:title"); this.Creator = item.GetValue("dc:creator"); this.Subject = item.GetValue("dc:subject"); this.Description = item.GetValue("dc:description"); this.Publisher = item.GetValue("dc:publisher"); this.Contributor = item.GetValue("dc:contributor"); this.DateString = item.GetValue("dc:date"); this.Date = Helpers.TryParseDateTime(DateString); this.Type = item.GetValue("dc:type"); this.Format = item.GetValue("dc:format"); this.Identifier = item.GetValue("dc:identifier"); this.Source = item.GetValue("dc:source"); this.Language = item.GetValue("dc:language"); this.Relation = item.GetValue("dc:relation"); this.Coverage = item.GetValue("dc:coverage"); this.Rights = item.GetValue("dc:rights"); }