private static LightWeightHTMLDocument FromIHTMLDocument2(IHTMLDocument2 htmlDocument, string url, string name, bool escapePaths, bool escapeEmptyString) { string escapedHtml = HTMLDocumentHelper.HTMLDocToString(htmlDocument); if (escapedHtml == null) { return(null); } if (escapePaths) { escapedHtml = LightWeightHTMLUrlToAbsolute.ConvertToAbsolute(escapedHtml, url, true, escapeEmptyString); } LightWeightHTMLDocument finalDocument = new LightWeightHTMLDocument(escapedHtml, url, name); // Set the Frames finalDocument.SetFrames(GetLightWeightDocumentForFrames(htmlDocument)); // Set the styles finalDocument.SetStyleReferences(HTMLDocumentHelper.GetStyleReferencesForDocument(htmlDocument, url)); // Set the DocType HTMLDocumentHelper.SpecialHeaders specialHeaders = HTMLDocumentHelper.GetSpecialHeaders(htmlDocument); finalDocument._docType = specialHeaders.DocType; finalDocument._savedFrom = specialHeaders.SavedFrom; finalDocument.Parse(); return(finalDocument); }
public static LightWeightHTMLDocument FromString(string html, string baseUrl, string name, bool escapePaths) { string escapedHtml = html; if (escapePaths) { escapedHtml = LightWeightHTMLUrlToAbsolute.ConvertToAbsolute(html, baseUrl); } LightWeightHTMLDocument escapedDocument = new LightWeightHTMLDocument(escapedHtml, baseUrl, name); HTMLDocumentHelper.SpecialHeaders specialHeaders = HTMLDocumentHelper.GetSpecialHeaders(escapedHtml, baseUrl); escapedDocument._docType = specialHeaders.DocType; escapedDocument._savedFrom = specialHeaders.SavedFrom; escapedDocument.Parse(); return(escapedDocument); }
private static LightWeightHTMLDocument FromIHTMLDocument2(IHTMLDocument2 htmlDocument, string url, string name, bool escapePaths, bool escapeEmptyString) { string escapedHtml = HTMLDocumentHelper.HTMLDocToString(htmlDocument); if (escapedHtml == null) return null; if (escapePaths) escapedHtml = LightWeightHTMLUrlToAbsolute.ConvertToAbsolute(escapedHtml, url, true, escapeEmptyString); LightWeightHTMLDocument finalDocument = new LightWeightHTMLDocument(escapedHtml, url, name); // Set the Frames finalDocument.SetFrames(GetLightWeightDocumentForFrames(htmlDocument)); // Set the styles finalDocument.SetStyleReferences(HTMLDocumentHelper.GetStyleReferencesForDocument(htmlDocument, url)); // Set the DocType HTMLDocumentHelper.SpecialHeaders specialHeaders = HTMLDocumentHelper.GetSpecialHeaders(htmlDocument); finalDocument._docType = specialHeaders.DocType; finalDocument._savedFrom = specialHeaders.SavedFrom; finalDocument.Parse(); return finalDocument; }
public static LightWeightHTMLDocument FromString(string html, string baseUrl, string name, bool escapePaths) { string escapedHtml = html; if (escapePaths) escapedHtml = LightWeightHTMLUrlToAbsolute.ConvertToAbsolute(html, baseUrl); LightWeightHTMLDocument escapedDocument = new LightWeightHTMLDocument(escapedHtml, baseUrl, name); HTMLDocumentHelper.SpecialHeaders specialHeaders = HTMLDocumentHelper.GetSpecialHeaders(escapedHtml, baseUrl); escapedDocument._docType = specialHeaders.DocType; escapedDocument._savedFrom = specialHeaders.SavedFrom; escapedDocument.Parse(); return escapedDocument; }