internal static Bundle Load(XmlReader reader, ErrorList errors) { XElement feed; try { feed = XDocument.Load(reader).Root; } catch (Exception exc) { errors.Add("Exception while loading feed: " + exc.Message); return null; } Bundle result; try { result = new Bundle() { Title = Util.StringValueOrNull(feed.Element(XATOMNS + XATOM_TITLE)), LastUpdated = Util.InstantOrNull(feed.Element(XATOMNS + XATOM_UPDATED)), Id = Util.UriValueOrNull(feed.Element(XATOMNS + XATOM_ID)), Links = getLinks(feed.Elements(XATOMNS + XATOM_LINK)), AuthorName = feed.Elements(XATOMNS + XATOM_AUTHOR).Count() == 0 ? null : Util.StringValueOrNull(feed.Element(XATOMNS + XATOM_AUTHOR) .Element(XATOMNS + XATOM_AUTH_NAME)), AuthorUri = feed.Elements(XATOMNS + XATOM_AUTHOR).Count() == 0 ? null : Util.StringValueOrNull(feed.Element(XATOMNS + XATOM_AUTHOR) .Element(XATOMNS + XATOM_AUTH_URI)), TotalResults = Util.IntValueOrNull(feed.Element(XOPENSEARCHNS + XATOM_TOTALRESULTS)) }; } catch (Exception exc) { errors.Add("Exception while parsing xml feed attributes: " + exc.Message, String.Format("Feed '{0}'", feed.Element(XATOMNS + XATOM_ID).Value)); return null; } result.Entries = loadEntries(feed.Elements().Where(elem => (elem.Name == XATOMNS + XATOM_ENTRY || elem.Name == XTOMBSTONE + XATOM_DELETED_ENTRY)), result, errors); errors.AddRange(result.Validate()); return result; }