Details
-
Bug
-
Resolution: Fixed
-
Major
-
6.4
-
None
-
N/A
-
N/A
-
Description
Unit test to prove it:
/** * Verify that a xmlns namespace set on the HTML element is not removed by default and it's removed if * {@link HTMLCleanerConfiguration#NAMESPACES_AWARE} is set to false. */ @Test public void cleanHTMLTagWithNamespace() throws Exception { String input = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>"; // Default Assert.assertEquals(HEADER + input + FOOTER, HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(input)))); // Configured for namespace awareness being false HTMLCleanerConfiguration config = this.mocker.getComponentUnderTest().getDefaultConfiguration(); config.setParameters(Collections.singletonMap(HTMLCleanerConfiguration.NAMESPACES_AWARE, "false")); Assert.assertEquals(HEADER + "<html><head></head><body>" + FOOTER, HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(input), config))); }
The issue is with our custom serialization which removes it.
Attachments
Issue Links
- relates to
-
XCOMMONS-908 HTML Cleaner doesn't remove the xmlns attribute when it's set to be not namespace-aware
- Closed