@Test public void preserveDoubleEscapingInAttributes() throws Exception { CleanerProperties cleanerProperties = new CleanerProperties(); cleanerProperties.setDeserializeEntities(true); HtmlCleaner cleaner = new HtmlCleaner(cleanerProperties); TagNode tagNode = cleaner.clean("<?xml version = \"1.0\"?><div foo=\"&amp;quot;\">&amp;quot;</div>"); List<? extends TagNode> divList = tagNode.getElementListByName("div", true); assertEquals(1, divList.size()); assertEquals("&quot;", divList.get(0).getText().toString()); assertEquals("&quot;", divList.get(0).getAttributeByName("foo")); DomSerializer domSerializer = new DomSerializer(cleanerProperties, false); Document document = domSerializer.createDOM(tagNode); NodeList nodeList = document.getElementsByTagName("div"); assertEquals(1, nodeList.getLength()); assertEquals("&quot;", nodeList.item(0).getTextContent()); assertEquals("&quot;", nodeList.item(0).getAttributes().getNamedItem("foo").getTextContent()); document = this.cleaner.clean(new StringReader("<div foo=\"&amp;quot;\">&amp;quot;</div>")); nodeList = document.getElementsByTagName("div"); assertEquals(1, nodeList.getLength()); assertEquals("&quot;", nodeList.item(0).getTextContent()); assertEquals("&quot;", nodeList.item(0).getAttributes().getNamedItem("foo").getTextContent()); assertHTML("<div foo=\"&amp;quot;\">content</div>", "<div foo=\"&amp;quot;\">content</div>"); }
@Override public Document clean(Reader originalHtmlContent) { return clean(originalHtmlContent, getDefaultConfiguration()); }
DefaultHTMLCleaner implements HTMLCleaner { @Override public Document clean(Reader originalHtmlContent) { return clean(originalHtmlContent, getDefaultConfiguration()); } }
DefaultHTMLCleaner implements HTMLCleaner { @Override public Document clean(Reader originalHtmlContent) { return clean(originalHtmlContent, getDefaultConfiguration()); }  }
DefaultHTMLCleaner implements HTMLCleaner { @Override public Document clean(Reader originalHtmlContent) { return clean(originalHtmlContent, getDefaultConfiguration()); }  @Override Document clean(Reader originalHtmlContent); @Override Document clean(Reader originalHtmlContent, HTMLCleanerConfiguration configuration); @Override HTMLCleanerConfiguration getDefaultConfiguration(); }
DefaultHTMLCleaner implements HTMLCleaner { @Override public Document clean(Reader originalHtmlContent) { return clean(originalHtmlContent, getDefaultConfiguration()); }  @Override Document clean(Reader originalHtmlContent); @Override Document clean(Reader originalHtmlContent, HTMLCleanerConfiguration configuration); @Override HTMLCleanerConfiguration getDefaultConfiguration();  }