Exemplo n.º 1
0
        /// <summary>
        /// Parses the result.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses the result.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        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;
        }