Ejemplo n.º 1
0
        /// <summary>
        /// Tries the parse to XML.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <param name="document">The document.</param>
        /// <returns></returns>
        public bool TryParseToXml(string response, out XDocument document)
        {
            string result = SgmlConverter.ParseHtml(response);

            if (result.Length == 0)
            {
                document = null;
                return(false);
            }
            else
            {
                document = XDocument.Parse(result);
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries the parse to XML.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <param name="document">The document.</param>
        /// <returns></returns>
        public XDocument ParseToXml(string response, Func <string, string> preparse)
        {
            XDocument document    = null;
            string    newResponse = preparse(response);
            string    result      = SgmlConverter.ParseHtml(newResponse);

            if (result.Length == 0)
            {
                document = null;
            }
            else
            {
                document = XDocument.Parse(result);
            }
            return(document);
        }