public string Clean(string content) { content = new OfficeNameSpacesTagsRemover().Clean(content); content = new TidyHTMLCleaner(false).Clean(content); content = new XmlNamespaceDefinitionsReplacer(htmlOpeningTag).Clean(content); content = new EmptyParagraphsCleaner().Clean(content); content = new NbspBetweenTagsRemover().Clean(content); content = new NbspReplacer().Clean(content); return content; }
public string Clean(string content) { content = new OfficeNameSpacesTagsRemover().Clean(content); content = new TidyHTMLCleaner(false).Clean(content); content = new XmlNamespaceDefinitionsReplacer(htmlOpeningTag).Clean(content); content = new EmptyParagraphsCleaner().Clean(content); content = new NbspBetweenTagsRemover().Clean(content); content = new NbspReplacer().Clean(content); return(content); }
public void TestCleaner() { bool canLoadXML = false; initialHTML = new XmlNamespaceDefinitionsReplacer(newTag).Clean(initialHTML); Assert.AreEqual(initialHTML, expectedHTML); try { new XmlDocument().LoadXml(initialHTML); canLoadXML = true; } catch { canLoadXML = false; } Assert.IsTrue(canLoadXML); }
/// <summary> /// Main HTML cleaner for <code>LocalToWeb</code>. It calls other HTML cleaners in a certain order /// and returns the cleaned HTML. /// </summary> /// <param name="content">HTML content.</param> /// <returns>Cleaned HTML content.</returns> public string Clean(string content) { String uncleanedContent = new CorrectAttributesCleaner().Clean(content); uncleanedContent = new CorrectTagsClosingCleaner("img").Clean(uncleanedContent); uncleanedContent = new CorrectTagsClosingCleaner("br").Clean(uncleanedContent); content = new TidyHTMLCleaner(true).Clean(uncleanedContent); if (content.Length == 0) { content = uncleanedContent; } content = new XmlNamespaceDefinitionsReplacer(htmlOpeningTag).Clean(content); content = new ListCharsCleaner().Clean(content); content = new EmptyParagraphsCleaner().Clean(content); content = new NbspBetweenTagsRemover().Clean(content); content = new OfficeNameSpacesTagsRemover().Clean(content); content = new NbspReplacer().Clean(content); content = new CommentsDivCleaner().Clean(content); return content; }
/// <summary> /// Main HTML cleaner for <code>LocalToWeb</code>. It calls other HTML cleaners in a certain order /// and returns the cleaned HTML. /// </summary> /// <param name="content">HTML content.</param> /// <returns>Cleaned HTML content.</returns> public string Clean(string content) { String uncleanedContent = new CorrectAttributesCleaner().Clean(content); uncleanedContent = new CorrectTagsClosingCleaner("img").Clean(uncleanedContent); uncleanedContent = new CorrectTagsClosingCleaner("br").Clean(uncleanedContent); content = new TidyHTMLCleaner(true).Clean(uncleanedContent); if (content.Length == 0) { content = uncleanedContent; } content = new XmlNamespaceDefinitionsReplacer(htmlOpeningTag).Clean(content); content = new ListCharsCleaner().Clean(content); content = new EmptyParagraphsCleaner().Clean(content); content = new NbspBetweenTagsRemover().Clean(content); content = new OfficeNameSpacesTagsRemover().Clean(content); content = new NbspReplacer().Clean(content); content = new CommentsDivCleaner().Clean(content); return(content); }