Ejemplo n.º 1
0
        private void ReadDocument(XmlReader reader)
        {
            try
            {
                SyndicationFeedFormatter.MoveToStartElement(reader);
                SetDocument(AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null,
                                                                             delegate()
                {
                    return(this.CreateInlineCategoriesDocument());
                },

                                                                             delegate()
                {
                    return(this.CreateReferencedCategoriesDocument());
                },
                                                                             this.Version,
                                                                             _preserveElementExtensions,
                                                                             _preserveAttributeExtensions,
                                                                             _maxExtensionSize));
            }
            catch (FormatException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e));
            }
            catch (ArgumentException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e));
            }
        }
        private async Task ReadDocumentAsync(XmlReaderWrapper reader)
        {
            try
            {
                await SyndicationFeedFormatter.MoveToStartElementAsync(reader);

                SetDocument(await AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null,
                                                                                   delegate()
                {
                    return(this.CreateInlineCategoriesDocument());
                },

                                                                                   delegate()
                {
                    return(this.CreateReferencedCategoriesDocument());
                },
                                                                                   this.Version,
                                                                                   _preserveElementExtensions,
                                                                                   _preserveAttributeExtensions,
                                                                                   _maxExtensionSize));
            }
            catch (FormatException e)
            {
                throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e);
            }
            catch (ArgumentException e)
            {
                throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e);
            }
        }
        private void ReadDocument(XmlReader reader)
        {
            CreateInlineCategoriesDelegate     inlineCategoriesFactory     = null;
            CreateReferencedCategoriesDelegate referencedCategoriesFactory = null;

            try
            {
                SyndicationFeedFormatter.MoveToStartElement(reader);
                if (inlineCategoriesFactory == null)
                {
                    inlineCategoriesFactory = () => this.CreateInlineCategoriesDocument();
                }
                if (referencedCategoriesFactory == null)
                {
                    referencedCategoriesFactory = () => this.CreateReferencedCategoriesDocument();
                }
                this.SetDocument(AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null, inlineCategoriesFactory, referencedCategoriesFactory, this.Version, this.preserveElementExtensions, this.preserveAttributeExtensions, this.maxExtensionSize));
            }
            catch (FormatException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(FeedUtils.AddLineInfo(reader, "ErrorParsingDocument"), exception));
            }
            catch (ArgumentException exception2)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(FeedUtils.AddLineInfo(reader, "ErrorParsingDocument"), exception2));
            }
        }
Ejemplo n.º 4
0
 private void ReadDocument(XmlReader reader)
 {
     try
     {
         SyndicationFeedFormatter.MoveToStartElement(reader);
         SetDocument(AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null,
                                                                      () => CreateInlineCategoriesDocument(),
                                                                      () => CreateReferencedCategoriesDocument(),
                                                                      Version,
                                                                      _maxExtensionSize));
     }
     catch (FormatException e)
     {
         throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e);
     }
     catch (ArgumentException e)
     {
         throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e);
     }
 }