protected void sendInlineEvent(Event event) throws SAXException { if (event.type == Event.Type.BEGIN_ELEMENT) { super.startElement(event.uri, event.localName, event.qName, event.atts); } else if (event.type == Event.Type.END_ELEMENT) { super.endElement(event.uri, event.localName, event.qName); } else if (event.type == Event.Type.COMMENT) { super.comment(event.content.toCharArray(), 0, event.content.length()); } }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (NONVISIBLE_ELEMENTS.contains(qName)) { endNonVisibleElement(); super.endElement(uri, localName, qName); --fNoCleanUpLevel; } else { if (NONINLINE_ELEMENTS.contains(qName)) { // Flush previous content and print current one flushContent(); // white spaces inside pre element are not cleaned if ("pre".equalsIgnoreCase(qName)) { --fNoCleanUpLevel; } super.endElement(uri, localName, qName); } else if (EMPTYVISIBLE_ELEMENTS.contains(qName)) { endEmptyVisibleElement(); super.endElement(uri, localName, qName); } else if (preservedInlineContent(localName, fAttributes.peek())) { // Flush previous content and print current one flushContent(); --fNoCleanUpLevel; super.endElement(uri, localName, qName); } else { appendInlineEvent(new Event(uri, localName, qName)); } } fAttributes.pop(); }