RTEditor/src/main/java/com/onegravity/rteditor/converter/tagsoup/HTMLWriter.java
@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        writeText4Links();
        if (!mIgnoredTags.isEmpty() && mIgnoredTags.peek().equalsIgnoreCase(qName)) {
            mIgnoredTags.pop();
        } else {
            if (!(htmlMode
                    && (uri.equals("http://www.w3.org/1999/xhtml") || uri.equals("")) && (qName.equals("area")
                    || qName.equals("base") || qName.equals("basefont")
                    || qName.equals("br") || qName.equals("col")
                    || qName.equals("frame") || qName.equals("hr")
                    || qName.equals("img") || qName.equals("input")
                    || qName.equals("isindex") || qName.equals("link")
                    || qName.equals("meta") || qName.equals("param")))) {
                write("</");
                writeName(uri, localName, qName, true);
                write('>');
            }
            if (elementLevel == 1) {
                write('\n');
            }
            if (htmlMode && localName.equals("a")) {
                mIgnoreChars = false;
            }
            cdataElement = false;
            super.endElement(uri, localName, qName);
            nsSupport.popContext();
            elementLevel--;
        }
    }
@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        writeText4Links();
        if (!mIgnoredTags.isEmpty() && mIgnoredTags.peek().equalsIgnoreCase(qName)) {
            mIgnoredTags.pop();
        } else {
            if (!(htmlMode
                    && (uri.equals("http://www.w3.org/1999/xhtml") || uri.equals("")) && (qName.equals("area")
                    || qName.equals("base") || qName.equals("basefont")
                    || qName.equals("br") || qName.equals("col")
                    || qName.equals("frame") || qName.equals("hr")
                    || qName.equals("img") || qName.equals("input")
                    || qName.equals("isindex") || qName.equals("link")
                    || qName.equals("meta") || qName.equals("param")))) {
                write("</");
                writeName(uri, localName, qName, true);
                write('>');
            }
            if (elementLevel == 1) {
                write('\n');
            }
            if (htmlMode && localName.equals("a")) {
                mIgnoreChars = false;
            }
            cdataElement = false;
            super.endElement(uri, localName, qName);
            nsSupport.popContext();
            elementLevel--;
        }
    }
@ Override public void endElement ( String uri , String localName , String qName ) throws SAXException { writeText4Links ( ) ; if ( ! mIgnoredTags . isEmpty ( ) && mIgnoredTags . peek ( ) . equalsIgnoreCase ( qName ) ) { mIgnoredTags . pop ( ) ; } else { if ( ! ( htmlMode && ( uri . equals ( "http://www.w3.org/1999/xhtml" ) || uri . equals ( "" ) ) && ( qName . equals ( "area" ) || qName . equals ( "base" ) || qName . equals ( "basefont" ) || qName . equals ( "br" ) || qName . equals ( "col" ) || qName . equals ( "frame" ) || qName . equals ( "hr" ) || qName . equals ( "img" ) || qName . equals ( "input" ) || qName . equals ( "isindex" ) || qName . equals ( "link" ) || qName . equals ( "meta" ) || qName . equals ( "param" ) ) ) ) { write ( "</" ) ; writeName ( uri , localName , qName , true ) ; write ( ' ' ) ; } if ( elementLevel == 1 ) { write ( ' ' ) ; } if ( htmlMode && localName . equals ( "a" ) ) { mIgnoreChars = false ; } cdataElement = false ; super . endElement ( uri , localName , qName ) ; nsSupport . popContext ( ) ; elementLevel -- ; } }
Write an end tag.
<p>
Pass the event on down the filter chain for further processing.

@param uri       The Namespace URI, or the empty string if none is available.
@param localName The element's local (unprefixed) name (required).
@param qName     The element's qualified (prefixed) name, or the empty string
is none is available. This method will use the qName as a
template for generating a prefix if necessary, but it is not
guaranteed to use the same qName.
@throws org.xml.sax.SAXException If there is an error writing the end tag, or if a handler
further down the filter chain raises an exception.
@see org.xml.sax.ContentHandler#endElement
Write an end tag . <p > Pass the event on down the filter chain for further processing .