private string GetTextNodePlaintext(string xpath, string defaultValue)
        {
            XmlElement el = GetElement(xpath);

            if (el != null)
            {
                return(_atomVer.TextNodeToPlaintext(el));
            }
            else
            {
                return(defaultValue);
            }
        }
        protected BlogInfo[] GetUsersBlogsInternal()
        {
            Uri         serviceUri = FeedServiceUrl;
            XmlDocument xmlDoc     = xmlRestRequestHelper.Get(ref serviceUri, RequestFilter);

            // Either the FeedServiceUrl points to a service document OR a feed.

            if (xmlDoc.SelectSingleNode("/app:service", _nsMgr) != null)
            {
                ArrayList blogInfos = new ArrayList();
                foreach (XmlElement coll in xmlDoc.SelectNodes("/app:service/app:workspace/app:collection", _nsMgr))
                {
                    bool promote = ShouldPromote(coll);

                    // does this collection accept entries?
                    XmlNodeList acceptNodes    = coll.SelectNodes("app:accept", _nsMgr);
                    bool        acceptsEntries = false;
                    if (acceptNodes.Count == 0)
                    {
                        acceptsEntries = true;
                    }
                    else
                    {
                        foreach (XmlElement acceptNode in acceptNodes)
                        {
                            if (AcceptsEntry(acceptNode.InnerText))
                            {
                                acceptsEntries = true;
                                break;
                            }
                        }
                    }

                    if (acceptsEntries)
                    {
                        string feedUrl = XmlHelper.GetUrl(coll, "@href", serviceUri);
                        if (feedUrl == null || feedUrl.Length == 0)
                        {
                            continue;
                        }

                        // form title
                        StringBuilder titleBuilder = new StringBuilder();
                        foreach (XmlElement titleContainerNode in new XmlElement[] { coll.ParentNode as XmlElement, coll })
                        {
                            Debug.Assert(titleContainerNode != null);
                            if (titleContainerNode != null)
                            {
                                XmlElement titleNode = titleContainerNode.SelectSingleNode("atom:title", _nsMgr) as XmlElement;
                                if (titleNode != null)
                                {
                                    string titlePart = _atomVer.TextNodeToPlaintext(titleNode);
                                    if (titlePart.Length != 0)
                                    {
                                        Res.LOCME("loc the separator between parts of the blog name");
                                        if (titleBuilder.Length != 0)
                                        {
                                            titleBuilder.Append(" - ");
                                        }
                                        titleBuilder.Append(titlePart);
                                    }
                                }
                            }
                        }

                        // get homepage URL
                        string      homepageUrl = "";
                        string      dummy       = "";
                        Uri         tempFeedUrl = new Uri(feedUrl);
                        XmlDocument feedDoc     = xmlRestRequestHelper.Get(ref tempFeedUrl, RequestFilter);
                        ParseFeedDoc(feedDoc, tempFeedUrl, false, ref homepageUrl, ref dummy);

                        // TODO: Sniff out the homepage URL
                        BlogInfo blogInfo = new BlogInfo(feedUrl, titleBuilder.ToString().Trim(), homepageUrl);
                        if (promote)
                        {
                            blogInfos.Insert(0, blogInfo);
                        }
                        else
                        {
                            blogInfos.Add(blogInfo);
                        }
                    }
                }

                return((BlogInfo[])blogInfos.ToArray(typeof(BlogInfo)));
            }
            else
            {
                string title       = string.Empty;
                string homepageUrl = string.Empty;

                ParseFeedDoc(xmlDoc, serviceUri, true, ref homepageUrl, ref title);

                return(new BlogInfo[] { new BlogInfo(UrlHelper.SafeToAbsoluteUri(FeedServiceUrl), title, homepageUrl) });
            }
        }