Пример #1
0
        protected virtual XmlDocument GetCategoryXml(ref string blogId)
        {
            // Get the service document
            Login();

            FixupBlogId(ref blogId);

            Uri         uri    = FeedServiceUrl;
            XmlDocument xmlDoc = xmlRestRequestHelper.Get(ref uri, RequestFilter);

            foreach (XmlElement entryEl in xmlDoc.SelectNodes("app:service/app:workspace/app:collection", _nsMgr))
            {
                string href = XmlHelper.GetUrl(entryEl, "@href", uri);
                if (blogId == href)
                {
                    XmlDocument results     = new XmlDocument();
                    XmlElement  rootElement = results.CreateElement("categoryInfo");
                    results.AppendChild(rootElement);
                    foreach (XmlElement categoriesNode in entryEl.SelectNodes("app:categories", _nsMgr))
                    {
                        AddCategoriesXml(categoriesNode, rootElement, uri);
                    }
                    return(results);
                }
            }
            Trace.Fail("Couldn't find collection in service document:\r\n" + xmlDoc.OuterXml);
            return(new XmlDocument());
        }
Пример #2
0
        protected virtual async Task <XmlDocument> GetCategoryXml(string blogId)
        {
            // Get the service document
            Login();

            FixupBlogId(ref blogId);

            XmlRestRequestHelper.XmlRequestResult result = new XmlRestRequestHelper.XmlRequestResult();
            result.uri = FeedServiceUrl;
            var xmlDoc = await xmlRestRequestHelper.Get(RequestFilter, result);

            foreach (XmlElement entryEl in xmlDoc.SelectNodesNS("app:service/app:workspace/app:collection", _nsMgr.ToNSMethodFormat()))
            {
                string href = XmlHelper.GetUrl(entryEl, "@href", result.uri);
                if (blogId == href)
                {
                    XmlDocument results     = new XmlDocument();
                    XmlElement  rootElement = results.CreateElement("categoryInfo");
                    results.AppendChild(rootElement);
                    foreach (XmlElement categoriesNode in entryEl.SelectNodesNS("app:categories", _nsMgr.ToNSMethodFormat()))
                    {
                        await AddCategoriesXml(categoriesNode, rootElement, result);
                    }
                    return(results);
                }
            }
            //Debug.Fail("Couldn't find collection in service document:\r\n" + xmlDoc.OuterXml);
            return(new XmlDocument());
        }