Esempio n. 1
0
        /// <summary>
        /// Sets Links based on the inputed ATOM xml.
        /// </summary>
        public void SetLinksFromXmlAtomEntry(XElement xEntry)
        {
            foreach (var xLink in xEntry.Elements("link"))
            {
                SFLink link = SFLink.AtomXmlLinkToLink(xLink);
                AddLink(link);
            }

            var contentSrcElem = xEntry
                                 .Elements("content")
                                 .FirstOrDefault(e => e.Attribute("src") != null);

            //.Where(e => e.Attribute("src") != null)
            //var contentSrcElem = xEntry.Element("content", "src");

            if (contentSrcElem != null)
            {
                var cSrcLnk = SFLink.AtomXmlLinkToLink(contentSrcElem);
                if (cSrcLnk != null)
                {
                    cSrcLnk.Rel = SFRel.src;
                    AddLink(cSrcLnk);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sets Links based on the inputed RSS xml.
        /// </summary>
        /// <param name="xEntry">RSS item.</param>
        public void SetLinksFromXmlRssItem(XElement xEntry)
        {
            if (xEntry != null)
            {
                XElement[] elems = xEntry.Elements().ToArray();

                foreach (var xLink in elems.Where(e => e.Name == "link" || e.Name == "enclosure"))
                {
                    SFLink link = SFLink.RssXmlLinkOrEnclosureToLink(xLink);
                    AddLink(link);
                }
                foreach (var xLink in elems.Where(e => e.Name == SimpleFeed.xname_Atom_Link))
                {
                    SFLink link = SFLink.AtomXmlLinkToLink(xLink);
                    AddLink(link);
                }
                foreach (var xLink in elems.Where(e => e.Name == SimpleFeed.xname_yahoomrss_content))
                {
                    SFLink link = SFLink.YahooMRSSXmlMediaElementToLink(xLink);
                    AddLink(link);
                }
            }
        }