From: Li Li <fan...@gm...> - 2014-04-18 01:49:06
|
I want to use ElementRemover to remove script but failed. I read the document and there are two sets: acceptElement and removeElement what's the meaning ? if an element is in acceptElement set, then it's accepted? if it's in removeElement, then be removed? what about elements not in both sets? my codes: DOMParser parser = new DOMParser(); XMLInputSource source = new XMLInputSource(null, "xpath-wrapper", null, new StringReader(content), charSet); parser.setFeature("http://xml.org/sax/features/namespaces", false); parser.setProperty( "http://cyberneko.org/html/properties/default-encoding", charSet); if (removeScript) { ElementRemover remover = new ElementRemover(); remover.removeElement("script"); parser.setProperty("http://cyberneko.org/html/properties/filters", new XMLDocumentFilter[] { remover }); } parser.parse(source); document = parser.getDocument(); |