/// <summary> /// Gets the text included in the external source. /// </summary> /// <param name="url">The URL of the external source.</param> /// <returns>The contained string.</returns> String GetText(String url) { if (Configuration.HasHttpRequester) { if (!Location.IsAbsolute(url)) { url = Location.MakeAbsolute(_result.Url, url); } var http = Configuration.GetHttpRequester(); var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) }); var stream = new SourceManager(response.Content); var tok = new DtdPlainTokenizer(_result, stream); var token = tok.Get(); if (token.Type == DtdTokenType.TextDecl) { var pi = (DtdDeclToken)token; if (!String.IsNullOrEmpty(pi.Encoding)) { SetEncoding(stream, pi.Encoding); } token = tok.Get(); } if (token.Type == DtdTokenType.Comment) { return(((DtdCommentToken)token).Data); } } return(String.Empty); }
/// <summary> /// Gets the text included in the external source. /// </summary> /// <param name="url">The URL of the external source.</param> /// <returns>The contained string.</returns> String GetText(String url) { if (Configuration.HasHttpRequester) { if (!Location.IsAbsolute(url)) url = Location.MakeAbsolute(_result.Url, url); var http = Configuration.GetHttpRequester(); var response = http.Request(new DefaultHttpRequest { Address = new Uri(url) }); var stream = new SourceManager(response.Content); var tok = new DtdPlainTokenizer(_result, stream); var token = tok.Get(); if (token.Type == DtdTokenType.TextDecl) { var pi = (DtdDeclToken)token; if (!String.IsNullOrEmpty(pi.Encoding)) SetEncoding(stream, pi.Encoding); token = tok.Get(); } if (token.Type == DtdTokenType.Comment) return ((DtdCommentToken)token).Data; } return String.Empty; }