private void WriteCollection(XmlWriter writer, ResourceCollectionInfo collection, Uri baseUri) { writer.WriteStartElement("app", "collection", "http://www.w3.org/2007/app"); Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, collection.BaseUri); if (baseUriToWrite != null) { baseUri = collection.BaseUri; WriteXmlBase(writer, baseUriToWrite); } if (collection.Link != null) { writer.WriteAttributeString("href", FeedUtils.GetUriString(collection.Link)); } ServiceDocumentFormatter.WriteAttributeExtensions(writer, collection, this.Version); if (collection.Title != null) { collection.Title.WriteTo(writer, "title", "http://www.w3.org/2005/Atom"); } for (int i = 0; i < collection.Accepts.Count; i++) { writer.WriteElementString("app", "accept", "http://www.w3.org/2007/app", collection.Accepts[i]); } for (int j = 0; j < collection.Categories.Count; j++) { WriteCategories(writer, collection.Categories[j], baseUri, this.Version); } ServiceDocumentFormatter.WriteElementExtensions(writer, collection, this.Version); writer.WriteEndElement(); }
private static void WriteReferencedCategoriesContent(XmlWriter writer, ReferencedCategoriesDocument categories, string version) { if (categories.Link != null) { writer.WriteAttributeString("href", FeedUtils.GetUriString(categories.Link)); } ServiceDocumentFormatter.WriteAttributeExtensions(writer, categories, version); ServiceDocumentFormatter.WriteElementExtensions(writer, categories, version); }
private static void WriteInlineCategoriesContent(XmlWriter writer, InlineCategoriesDocument categories, string version) { if (!string.IsNullOrEmpty(categories.Scheme)) { writer.WriteAttributeString("scheme", categories.Scheme); } if (categories.IsFixed) { writer.WriteAttributeString("fixed", "yes"); } ServiceDocumentFormatter.WriteAttributeExtensions(writer, categories, version); for (int i = 0; i < categories.Categories.Count; i++) { Atom10FeedFormatter.WriteCategory(writer, categories.Categories[i], version); } ServiceDocumentFormatter.WriteElementExtensions(writer, categories, version); }
private void WriteDocument(XmlWriter writer) { writer.WriteAttributeString("a10", "http://www.w3.org/2000/xmlns/", "http://www.w3.org/2005/Atom"); if (!string.IsNullOrEmpty(base.Document.Language)) { WriteXmlLang(writer, base.Document.Language); } Uri baseUri = base.Document.BaseUri; if (baseUri != null) { WriteXmlBase(writer, baseUri); } ServiceDocumentFormatter.WriteAttributeExtensions(writer, base.Document, this.Version); for (int i = 0; i < base.Document.Workspaces.Count; i++) { this.WriteWorkspace(writer, base.Document.Workspaces[i], baseUri); } ServiceDocumentFormatter.WriteElementExtensions(writer, base.Document, this.Version); }
private void WriteWorkspace(XmlWriter writer, Workspace workspace, Uri baseUri) { writer.WriteStartElement("app", "workspace", "http://www.w3.org/2007/app"); Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, workspace.BaseUri); if (baseUriToWrite != null) { baseUri = workspace.BaseUri; WriteXmlBase(writer, baseUriToWrite); } ServiceDocumentFormatter.WriteAttributeExtensions(writer, workspace, this.Version); if (workspace.Title != null) { workspace.Title.WriteTo(writer, "title", "http://www.w3.org/2005/Atom"); } for (int i = 0; i < workspace.Collections.Count; i++) { this.WriteCollection(writer, workspace.Collections[i], baseUri); } ServiceDocumentFormatter.WriteElementExtensions(writer, workspace, this.Version); writer.WriteEndElement(); }