/// <summary> /// Modifies the <see cref="AtomServiceDocument"/> to match the data source. /// </summary> /// <param name="resource">The <see cref="AtomServiceDocument"/> to be filled.</param> /// <exception cref="ArgumentNullException">The <paramref name="resource"/> is a null reference (Nothing in Visual Basic).</exception> public void Fill(AtomServiceDocument resource) { Guard.ArgumentNotNull(resource, "resource"); XmlNamespaceManager manager = AtomUtility.CreateNamespaceManager(this.Navigator.NameTable); XPathNavigator documentNavigator = this.Navigator.SelectSingleNode("app:service", manager); if (documentNavigator != null) { AtomUtility.FillCommonObjectAttributes(resource, documentNavigator); if (documentNavigator.HasChildren) { XPathNodeIterator workspaceIterator = documentNavigator.Select("app:workspace", manager); if (workspaceIterator != null && workspaceIterator.Count > 0) { while (workspaceIterator.MoveNext()) { AtomWorkspace workspace = new AtomWorkspace(); if (workspace.Load(workspaceIterator.Current, this.Settings)) { resource.AddWorkspace(workspace); } } } } SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(documentNavigator, this.Settings); adapter.Fill(resource, manager); } }
/// <summary> /// Modifies the <see cref="ISyndicationResource"/> to match the data source. /// </summary> /// <param name="resource">The Atom Publishing Protocol <see cref="ISyndicationResource"/> to be filled.</param> /// <param name="resourceMetadata">A <see cref="SyndicationResourceMetadata"/> object that represents the meta-data describing the <paramref name="resource"/>.</param> /// <exception cref="ArgumentNullException">The <paramref name="resource"/> is a null reference (Nothing in Visual Basic).</exception> /// <exception cref="ArgumentNullException">The <paramref name="resourceMetadata"/> is a null reference (Nothing in Visual Basic).</exception> private void FillAtomPublishingResource(ISyndicationResource resource, SyndicationResourceMetadata resourceMetadata) { //------------------------------------------------------------ // Validate parameter //------------------------------------------------------------ Guard.ArgumentNotNull(resource, "resource"); Guard.ArgumentNotNull(resourceMetadata, "resourceMetadata"); //------------------------------------------------------------ // Fill syndication resource using appropriate data adapter //------------------------------------------------------------ AtomCategoryDocument categoryDocument = resource as AtomCategoryDocument; AtomServiceDocument serviceDocument = resource as AtomServiceDocument; if (resourceMetadata.Version == new Version("1.0")) { AtomPublishing10SyndicationResourceAdapter atomPublishing10Adapter = new AtomPublishing10SyndicationResourceAdapter(this.Navigator, this.Settings); if (categoryDocument != null) { atomPublishing10Adapter.Fill(categoryDocument); } else if (serviceDocument != null) { atomPublishing10Adapter.Fill(serviceDocument); } } }