/** {@inheritDoc} */ public void startElement( String name ) { tagIsEmpty = false; finishTag(); write( "<" ); write( name ); elementStack.addLast( name ); tagInProgress = true; setDepth( getDepth() + 1 ); readyForNewLine = true; tagIsEmpty = true; }
/** * Write the end of line character (using specified line separator) and start new line with indentation * * @see #getLineIndenter() * @see #getLineSeparator() */ protected void endOfLine() { write( getLineSeparator() ); for ( int i = 0; i < getDepth(); i++ ) { write( getLineIndenter() ); } }
/** {@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; }