See also https://sourceforge.net/p/htmlcleaner/bugs/99
Input:
@Test public void cleanTitleWithNamespace() throws Exception { // Test with TITLE in HEAD String input = "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n" + " <head>\n" + " <title>Title test</title>\n" + " </head>\n" + " <body>\n" + " <p>before</p>\n" + " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"300\" width=\"500\">\n" + " <g>\n" + " <title>SVG Title Demo example</title>\n" + " <rect height=\"50\" style=\"fill:none; stroke:blue; stroke-width:1px\" width=\"200\" x=\"10\" " + "y=\"10\"></rect>\n" + " </g>\n" + " </svg>\n" + " <p>after</p>\n"; Assert.assertEquals(HEADER + input + FOOTER, HTMLUtils.toString(this.cleaner.clean(new StringReader(input)))); }
Results in extra new lines as shown on https://www.evernote.com/shard/s119/sh/7876478a-42d2-421d-9780-b53ea7c88660/9a60e113784cc72a16f560ef2d5a0f84
Moving to fix in 2.8
Rather than whitespace being added, its being moved from between the html, head and body tags and placed within them instead.
Hi, any news about this bug? I can see we still have an ignored test in our code base related to it :)