Upac.GoogleSiteSearch.GoogleSiteSearch.ParseResult C# (CSharp) Method

ParseResult() protected method

Parses the result.
protected ParseResult ( string data ) : GoogleSiteSearchParserResult
data string The data.
return GoogleSiteSearchParserResult
        protected virtual GoogleSiteSearchParserResult ParseResult(string data)
        {
            XmlDocument xmlDocument = new XmlDocument();

            // Load the result into a friendly structure
            try
            {
                xmlDocument.LoadXml(data);
            }
            catch (XmlException xmlException)
            {
                log.Error("An error occured while loading the Google SiteSearch XML.", xmlException);
            }

            // Parse the result
            try
            {
                GoogleSiteSearchParserResult result;
                using (GoogleSiteSearchParser googleSiteSearchParser = new GoogleSiteSearchParser())
                {
                    result = googleSiteSearchParser.Parse(xmlDocument.SelectSingleNode("GSP"));
                }

                return result;
            }
            catch (XPathException xPathException)
            {
                log.Error("An error occured while parsing the Google SiteSearch XML response.", xPathException);
            }

            return null;
        }