private static async Task WriteCategoriesAsync(XmlWriter writer, CategoriesDocument categories, Uri baseUri, string version)
        {
            await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace);

            await WriteCategoriesInnerXml(writer, categories, baseUri, version);

            await writer.WriteEndElementAsync();
        }
예제 #2
0
 protected CategoriesDocumentFormatter(CategoriesDocument documentToWrite)
 {
     if (documentToWrite == null)
     {
         throw new ArgumentNullException(nameof(documentToWrite));
     }
     _document = documentToWrite;
 }
예제 #3
0
        protected static Task WriteElementExtensionsAsync(XmlWriter writer, CategoriesDocument categories, string version)
        {
            if (categories == null)
            {
                throw new ArgumentNullException(nameof(categories));
            }

            return(categories.WriteElementExtensionsAsync(writer, version));
        }
예제 #4
0
        protected static bool TryParseElement(XmlReader reader, CategoriesDocument categories, string version)
        {
            if (categories == null)
            {
                throw new ArgumentNullException(nameof(categories));
            }

            return(categories.TryParseElement(XmlReaderWrapper.CreateFromReader(reader), version));
        }
예제 #5
0
        protected static void LoadElementExtensions(XmlReader reader, CategoriesDocument categories, int maxExtensionSize)
        {
            if (categories == null)
            {
                throw new ArgumentNullException(nameof(categories));
            }

            categories.LoadElementExtensions(XmlReaderWrapper.CreateFromReader(reader), maxExtensionSize);
        }
 public AtomPub10CategoriesDocumentFormatter(CategoriesDocument documentToWrite)
     : base(documentToWrite)
 {
     // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class
     _maxExtensionSize            = int.MaxValue;
     _preserveAttributeExtensions = true;
     _preserveElementExtensions   = true;
     if (documentToWrite.IsInline)
     {
         _inlineDocumentType     = documentToWrite.GetType();
         _referencedDocumentType = typeof(ReferencedCategoriesDocument);
     }
     else
     {
         _referencedDocumentType = documentToWrite.GetType();
         _inlineDocumentType     = typeof(InlineCategoriesDocument);
     }
 }
        internal static async Task WriteCategoriesInnerXml(XmlWriter writer, CategoriesDocument categories, Uri baseUri, string version)
        {
            Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, categories.BaseUri);

            if (baseUriToWrite != null)
            {
                WriteXmlBase(writer, baseUriToWrite);
            }

            if (!string.IsNullOrEmpty(categories.Language))
            {
                WriteXmlLang(writer, categories.Language);
            }

            if (categories.IsInline)
            {
                await WriteInlineCategoriesContentAsync(XmlWriterWrapper.CreateFromWriter(writer), (InlineCategoriesDocument)categories, version);
            }
            else
            {
                WriteReferencedCategoriesContent(writer, (ReferencedCategoriesDocument)categories, version);
            }
        }
예제 #8
0
 protected virtual void SetDocument(CategoriesDocument document)
 {
     _document = document;
 }
예제 #9
0
 internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, CategoriesDocument categories)
 {
     if (categories == null)
     {
         throw new ArgumentNullException(nameof(categories));
     }
     Atom10FeedFormatter.CloseBuffer(buffer, writer);
     categories.LoadElementExtensions(buffer);
 }
예제 #10
0
        protected static bool TryParseAttribute(string name, string ns, string value, CategoriesDocument categories, string version)
        {
            if (categories == null)
            {
                throw new ArgumentNullException(nameof(categories));
            }

            return(categories.TryParseAttribute(name, ns, value, version));
        }