private SAXReader installModifyReader() throws DocumentException { try { SAXModifyReader reader = getSAXModifyReader(); if (isPruneElements()) { modifyReader.setDispatchHandler(new PruningDispatchHandler()); } reader.resetHandlers(); Iterator modifierIt = this.modifiers.entrySet().iterator(); while (modifierIt.hasNext()) { Map.Entry entry = (Map.Entry) modifierIt.next(); SAXModifyElementHandler handler = new SAXModifyElementHandler((ElementModifier) entry.getValue()); reader.addHandler((String) entry.getKey(), handler); } reader.setXMLWriter(getXMLWriter()); reader.setXMLReader(getXMLReader()); return reader; } catch (SAXException ex) { throw new DocumentException(ex.getMessage(), ex); } }
private SAXReader installModifyReader() throws DocumentException { try { SAXModifyReader reader = getSAXModifyReader(); if (isPruneElements()) { modifyReader.setDispatchHandler(new PruningDispatchHandler()); } reader.resetHandlers(); for (Map.Entry<String, ElementModifier> entry : this.modifiers.entrySet()) { SAXModifyElementHandler handler = new SAXModifyElementHandler(entry.getValue()); reader.addHandler(entry.getKey(), handler); } reader.setXMLWriter(getXMLWriter()); reader.setXMLReader(getXMLReader()); return reader; } catch (SAXException ex) { throw new DocumentException(ex.getMessage(), ex); } }