예제 #1
0
 private void ReadAuthorElement(IODataAtomReaderEntryState entryState, EpmTargetPathSegment epmTargetPathSegment)
 {
     if (this.ShouldReadCollectionElement(entryState.AtomEntryMetadata.Authors.Any <AtomPersonMetadata>()))
     {
         AtomMetadataReaderUtils.AddAuthorToEntryMetadata(entryState.AtomEntryMetadata, base.ReadAtomPersonConstruct(epmTargetPathSegment));
     }
     else
     {
         base.XmlReader.Skip();
     }
 }
        /// <summary>
        /// Reads an author element.
        /// </summary>
        /// <param name="entryState">The reader entry state for the entry being read.</param>
        /// <param name="epmTargetPathSegment">The EPM target path segment for the element to read, or null if no EPM for that element is defined.</param>
        /// <remarks>
        /// Pre-Condition:  XmlNodeType.Element (atom:author) - the atom:author element to read.
        /// Post-Condition: Any                               - the node after the atom:author element which was read.
        /// </remarks>
        private void ReadAuthorElement(IODataAtomReaderEntryState entryState, EpmTargetPathSegment epmTargetPathSegment)
        {
            Debug.Assert(entryState != null, "entryState != null");
            this.AssertXmlCondition(XmlNodeType.Element);
            Debug.Assert(
                this.XmlReader.LocalName == AtomConstants.AtomAuthorElementName && this.XmlReader.NamespaceURI == AtomConstants.AtomNamespace,
                "Only atom:author elements can be read by this method.");

            if (this.ShouldReadCollectionElement(entryState.AtomEntryMetadata.Authors.Any()))
            {
                AtomMetadataReaderUtils.AddAuthorToEntryMetadata(
                    entryState.AtomEntryMetadata,
                    this.ReadAtomPersonConstruct(epmTargetPathSegment));
            }
            else
            {
                // Skip the element as we don't care about it
                this.XmlReader.Skip();
            }
        }