private void ReadCategoryElement(AtomFeedMetadata atomFeedMetadata)
        {
            AtomCategoryMetadata categoryMetadata = new AtomCategoryMetadata();

            while (base.XmlReader.MoveToNextAttribute())
            {
                string str;
                if (base.XmlReader.NamespaceEquals(this.EmptyNamespace) && ((str = base.XmlReader.LocalName) != null))
                {
                    if (!(str == "scheme"))
                    {
                        if (str == "term")
                        {
                            goto Label_0069;
                        }
                        if (str == "label")
                        {
                            goto Label_007C;
                        }
                    }
                    else
                    {
                        categoryMetadata.Scheme = base.XmlReader.Value;
                    }
                }
                continue;
Label_0069:
                categoryMetadata.Term = base.XmlReader.Value;
                continue;
Label_007C:
                categoryMetadata.Label = base.XmlReader.Value;
            }
            AtomMetadataReaderUtils.AddCategoryToFeedMetadata(atomFeedMetadata, categoryMetadata);
            base.XmlReader.Skip();
        }
示例#2
0
        /// <summary>
        /// Reads an atom:category element in a feed.
        /// </summary>
        /// <param name="atomFeedMetadata">The feed metadata to augment.</param>
        /// <remarks>
        /// Pre-Condition:  XmlNodeType.Element (atom:category) - the atom:category element to read.
        /// Post-Condition: Any                                 - the node after the atom:category which was read.
        /// </remarks>
        private void ReadCategoryElement(AtomFeedMetadata atomFeedMetadata)
        {
            DebugUtils.CheckNoExternalCallers();
            this.AssertXmlCondition(XmlNodeType.Element);
            Debug.Assert(
                this.XmlReader.NamespaceURI == AtomConstants.AtomNamespace && this.XmlReader.LocalName == AtomConstants.AtomCategoryElementName,
                "Only atom:category element can be read by this method.");

            AtomCategoryMetadata categoryMetadata = new AtomCategoryMetadata();

            // Read the attributes
            while (this.XmlReader.MoveToNextAttribute())
            {
                if (this.XmlReader.NamespaceEquals(this.EmptyNamespace))
                {
                    switch (this.XmlReader.LocalName)
                    {
                    case AtomConstants.AtomCategorySchemeAttributeName:
                        categoryMetadata.Scheme = this.XmlReader.Value;
                        break;

                    case AtomConstants.AtomCategoryTermAttributeName:
                        categoryMetadata.Term = this.XmlReader.Value;
                        break;

                    case AtomConstants.AtomCategoryLabelAttributeName:
                        categoryMetadata.Label = this.XmlReader.Value;
                        break;

                    default:
                        // Ignore all other attributes.
                        break;
                    }
                }
            }

            AtomMetadataReaderUtils.AddCategoryToFeedMetadata(atomFeedMetadata, categoryMetadata);

            // Skip the rest of the category element.
            this.XmlReader.Skip();
        }