/// <summary> /// Validates that the stream contains a valid feed item. /// </summary> public override void Start() { reader.MoveToContent(); if (!AtomHelper.IsAtomElement(reader, FormatterConstants.AtomPubFeedElementName)) { throw new InvalidOperationException("Not a valid ATOM feed."); } }
/// <summary> /// Traverses through the feed and returns when it arrives at the necessary element. /// </summary> /// <returns>bool detecting whether or not there is more elements to be read.</returns> public override bool Next() { // User did not read the node. if (currentType != ReaderItemType.BOF && !currentNodeRead) { reader.Skip(); } do { currentEntryWrapper = null; liveEntity = null; if (AtomHelper.IsAtomElement(reader, FormatterConstants.AtomPubEntryElementName) || AtomHelper.IsAtomTombstone(reader, FormatterConstants.AtomDeletedEntryElementName)) { currentType = ReaderItemType.Entry; currentNodeRead = false; return(true); } if (AtomHelper.IsSyncElement(reader, FormatterConstants.ServerBlobText)) { currentType = ReaderItemType.SyncBlob; currentNodeRead = false; return(true); } if (AtomHelper.IsSyncElement(reader, FormatterConstants.MoreChangesAvailableText)) { currentType = ReaderItemType.HasMoreChanges; currentNodeRead = false; return(true); } } while (reader.Read()); this.currentType = ReaderItemType.EOF; return(false); }