Esempio n. 1
0
        void GetFeedsFromAtom(string category, string atom, List<Feed> feeds)
        {
            var doc = Xml.Parse (atom);

            var baseUrl = doc.GetAttribute ("xml:base").Trim ();

            var newFeeds = new List<Feed> ();

            foreach (var coll in doc.ElementsWithName ("collection")) {

                var href = coll.GetAttribute ("href").Trim ();
                var title = coll.ElementText ("title").Trim ();

                var feed = new Feed {
                    Category = category,
                    BaseUrl = baseUrl,
                    Href = href,
                    Name = title
                };

                newFeeds.Add (feed);
            }

            foreach (var f in newFeeds) {

                try {
                    var subData = Http.Get (f.Url + "?$top=1");

                    var subXml = Xml.Parse (subData);

                    if (subXml.LocalName == "service") {

                        GetFeedsFromAtom (f.Name, Http.Get (f.Url), feeds);

                    } else {

                        GetMetadata (f);

                        feeds.Add (f);

                    }

                } catch (Exception) {
                }

            }
        }
Esempio n. 2
0
        void GetMetadata(Feed forFeed)
        {
            foreach (var m in Metadata) {
                if (m.BaseUrl == forFeed.BaseUrl) {
                    return;
                }
            }

            var url = forFeed.GetUrl ("$metadata");

            var doc = new MetadataDocument { BaseUrl = forFeed.BaseUrl };

            doc.DocumentBody = Http.Get (url);

            Metadata.Add (doc);
        }