public XDocument GetXDocumentResult() { XDocument xml = null; if (gsContentType == "text/html") { HtmlXml hx = new HtmlXml(new StringReader(gsTextResult)); hx.ReadCommentInText = gbReadCommentInText; xml = hx.GenerateXDocument(); } else if (gsContentType == "text/xml") { xml = XDocument.Parse(gsTextResult, LoadOptions.PreserveWhitespace); } else throw new PBException("Error can't transform \"{0}\" content to xml", gsContentType); if (gsTraceDirectory != null) gsXmlExportPath = GetNewHttpFileName(gsTraceDirectory, ".xml"); else if (gsXmlExportPath != null) { if (cu.PathGetExt(gsTextExportPath) == "") gsXmlExportPath = cu.PathSetExt(gsTextExportPath, ".xml"); } if (gsXmlExportPath != null) xml.Save(gsXmlExportPath); return xml; }
public static XmlDocument LoadHtml(string sUrl) { HtmlXml hx = new HtmlXml(sUrl); return hx.GenerateXmlDocument(); }