private async Task WriteWorkspaceAsync(XmlWriter writer, Workspace workspace, Uri baseUri) { await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Workspace, App10Constants.Namespace); Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, workspace.BaseUri); if (baseUriToWrite != null) { baseUri = workspace.BaseUri; WriteXmlBase(writer, baseUriToWrite); } WriteAttributeExtensions(writer, workspace, this.Version); if (workspace.Title != null) { await workspace.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace); } for (int i = 0; i < workspace.Collections.Count; ++i) { await WriteCollectionAsync(writer, workspace.Collections[i], baseUri); } await WriteElementExtensionsAsync(writer, workspace, this.Version); await writer.WriteEndElementAsync(); }
private async Task WriteCollectionAsync(XmlWriter writer, ResourceCollectionInfo collection, Uri baseUri) { await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Collection, App10Constants.Namespace); Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, collection.BaseUri); if (baseUriToWrite != null) { baseUri = collection.BaseUri; WriteXmlBase(writer, baseUriToWrite); } if (collection.Link != null) { await writer.WriteAttributeStringAsync(App10Constants.Href, FeedUtils.GetUriString(collection.Link)); } await WriteAttributeExtensionsAsync(writer, collection, this.Version); if (collection.Title != null) { await collection.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace); } for (int i = 0; i < collection.Accepts.Count; ++i) { await writer.WriteElementStringAsync(App10Constants.Prefix, App10Constants.Accept, App10Constants.Namespace, collection.Accepts[i]); } for (int i = 0; i < collection.Categories.Count; ++i) { await WriteCategoriesAsync(writer, collection.Categories[i], baseUri, this.Version); } await WriteElementExtensionsAsync(writer, collection, this.Version); await writer.WriteEndElementAsync(); }
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); } }