public void Load2()
 {
     ServiceDocument.Load(XmlReader.Create(new StringReader(app2)));
 }
        public override IEnumerable <IFragment> GetFragments(DateTime since, DateTime before)
        {
            // get list of all odata type collections
            var xmlReader = XmlReader.Create(_odataEndpoint, new XmlReaderSettings()
            {
                CloseInput = true
            });
            var serviceDocument = ServiceDocument.Load(xmlReader);

            if (serviceDocument.Workspaces.Count == 0)
            {
                throw new Exception("No workspace found in service document");
            }
            xmlReader.Close();

            var workspace = serviceDocument.Workspaces[0];

            foreach (var resourceCollectionInfo in workspace.Collections)
            {
                var             queryUrl = _odataEndpoint + resourceCollectionInfo.Link;
                SyndicationFeed feed     = null;
                XmlReader       reader   = null;
                try
                {
                    reader = XmlReader.Create(queryUrl, new XmlReaderSettings()
                    {
                        CloseInput = true
                    });
                    feed = SyndicationFeed.Load(reader);
                    reader.Close();
                } catch (Exception e)
                {
                    Logging.LogError(1, "Unable to fetch odata collection data {0} {1}", queryUrl, e.Message);
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }

                if (feed != null)
                {
                    // issue a query against each collection to find all entries that have changed since the give date
                    foreach (var syndicationItem in feed.Items)
                    {
                        Fragment fragment = null;
                        try {
                            if (syndicationItem.LastUpdatedTime.UtcDateTime > since)
                            {
                                fragment = new Fragment()
                                {
                                    PublishDate  = syndicationItem.LastUpdatedTime.UtcDateTime,
                                    ResourceId   = syndicationItem.Id,
                                    ResourceName = syndicationItem.Title.Text,
                                    ResourceUri  = syndicationItem.Id
                                };
                            }
                        } catch (Exception e)
                        {
                            Logging.LogError(1, "Unable to build fragment {0} {1}", e.Message, e.StackTrace);
                        }
                        if (fragment != null)
                        {
                            yield return(fragment);
                        }
                    }
                }
            }
            yield break;
        }