WebToLocal
public void TestCleaner() { bool noException = true; try { htmlContent = new WebToLocalHTMLCleaner(htmlOpeningTag).Clean(htmlContent); xmlDoc.LoadXml(htmlContent); } catch(Exception e) { Console.Error.WriteLine(e); noException = false; } Assert.IsTrue(noException); }
/// <summary> /// Adapts the Word generated content to XWiki friendly content. /// </summary> /// <param name="content"></param> /// <returns></returns> public String AdaptSource(String content) { XmlDocument xmlDoc = new XmlDocument(); content = new WebToLocalHTMLCleaner(HTML_OPENING_TAG).Clean(content); //content = content.Insert(0, DOCTYPE); try { xmlDoc.LoadXml(content); } catch (XmlException ex) { Log.Exception(ex); return "Sorry, a problem appeared when loading the page"; } List<IDOMFilter> webToLocalFilters = new List<IDOMFilter>() { new WebMacrosAdaptorFilter(manager), new WebImageAdaptorFilter(manager), new WebListsAdaptorFilter(manager), new WebToLocalStyleFilter(manager) }; foreach (IDOMFilter webToLocalFilter in webToLocalFilters) { webToLocalFilter.Filter(ref xmlDoc); } return xmlDoc.GetIndentedXml(); }