1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------
4 
5 namespace System.ServiceModel.Syndication
6 {
7     using System.Xml;
8     using System.Collections.ObjectModel;
9     using System.Collections.Generic;
10     using System.Diagnostics.CodeAnalysis;
11     using System.Runtime.Serialization;
12     using System.Xml.Serialization;
13     using System.Runtime.CompilerServices;
14 
15     [TypeForwardedFrom("System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
16     public abstract class CategoriesDocument : IExtensibleSyndicationObject
17     {
18         Uri baseUri;
19         ExtensibleSyndicationObject extensions = new ExtensibleSyndicationObject();
20         string language;
21 
CategoriesDocument()22         internal CategoriesDocument()
23         {
24         }
25 
26         public Dictionary<XmlQualifiedName, string> AttributeExtensions
27         {
28             get
29             {
30                 return this.extensions.AttributeExtensions;
31             }
32         }
33 
34         public Uri BaseUri
35         {
36             get { return this.baseUri; }
37             set { this.baseUri = value; }
38         }
39 
40         public SyndicationElementExtensionCollection ElementExtensions
41         {
42             get
43             {
44                 return this.extensions.ElementExtensions;
45             }
46         }
47 
48         public string Language
49         {
50             get { return this.language; }
51             set { this.language = value; }
52         }
53 
54         internal abstract bool IsInline
55         {
56             get;
57         }
58 
Create(Collection<SyndicationCategory> categories)59         public static InlineCategoriesDocument Create(Collection<SyndicationCategory> categories)
60         {
61             return new InlineCategoriesDocument(categories);
62         }
63 
Create(Collection<SyndicationCategory> categories, bool isFixed, string scheme)64         public static InlineCategoriesDocument Create(Collection<SyndicationCategory> categories, bool isFixed, string scheme)
65         {
66             return new InlineCategoriesDocument(categories, isFixed, scheme);
67         }
68 
Create(Uri linkToCategoriesDocument)69         public static ReferencedCategoriesDocument Create(Uri linkToCategoriesDocument)
70         {
71             return new ReferencedCategoriesDocument(linkToCategoriesDocument);
72         }
73 
Load(XmlReader reader)74         public static CategoriesDocument Load(XmlReader reader)
75         {
76             AtomPub10CategoriesDocumentFormatter formatter = new AtomPub10CategoriesDocumentFormatter();
77             formatter.ReadFrom(reader);
78             return formatter.Document;
79         }
80 
GetFormatter()81         public CategoriesDocumentFormatter GetFormatter()
82         {
83             return new AtomPub10CategoriesDocumentFormatter(this);
84         }
85 
Save(XmlWriter writer)86         public void Save(XmlWriter writer)
87         {
88             this.GetFormatter().WriteTo(writer);
89         }
90 
TryParseAttribute(string name, string ns, string value, string version)91         protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version)
92         {
93             return false;
94         }
95 
TryParseElement(XmlReader reader, string version)96         protected internal virtual bool TryParseElement(XmlReader reader, string version)
97         {
98             return false;
99         }
100 
WriteAttributeExtensions(XmlWriter writer, string version)101         protected internal virtual void WriteAttributeExtensions(XmlWriter writer, string version)
102         {
103             this.extensions.WriteAttributeExtensions(writer);
104         }
105 
WriteElementExtensions(XmlWriter writer, string version)106         protected internal virtual void WriteElementExtensions(XmlWriter writer, string version)
107         {
108             this.extensions.WriteElementExtensions(writer);
109         }
110 
LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize)111         internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize)
112         {
113             this.extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize);
114         }
115 
LoadElementExtensions(XmlBuffer buffer)116         internal void LoadElementExtensions(XmlBuffer buffer)
117         {
118             this.extensions.LoadElementExtensions(buffer);
119         }
120     }
121 }
122