private void finishTag() { if ( tagInProgress ) { write( ">" ); } tagInProgress = false; if ( readyForNewLine ) { endOfLine(); } readyForNewLine = false; tagIsEmpty = false; }
/** {@inheritDoc} */ public void endElement() { setDepth( getDepth() - 1 ); if ( tagIsEmpty ) { write( "/" ); readyForNewLine = false; finishTag(); elementStack.removeLast(); } else { finishTag(); // see issue #51: https://github.com/codehaus-plexus/plexus-utils/issues/51 // Rationale: replaced 1 write() with string concatenations with 3 write() // (this avoids the string concatenation optimization bug detected in Java 7) // TODO: change the below code to a more efficient expression when the library // be ready to target Java 8. write( "</" ); write( elementStack.removeLast() ); write( ">" ); } readyForNewLine = true; }
private void writeText( String text, boolean escapeXml ) { readyForNewLine = false; tagIsEmpty = false; finishTag(); if ( escapeXml ) { text = escapeXml( text ); } write( StringUtils.unifyLineSeparators( text, lineSeparator ) ); }