/** {@inheritDoc} */ public void startElement( String name ) { tagIsEmpty = false; finishTag(); write( "<" ); write( name ); elementStack.addLast( name ); tagInProgress = true; setDepth( getDepth() + 1 ); readyForNewLine = true; tagIsEmpty = true; }
private void writeText( String text, boolean escapeXml ) { readyForNewLine = false; tagIsEmpty = false; finishTag(); if ( escapeXml ) { text = escapeXml( text ); } write( StringUtils.unifyLineSeparators( text, lineSeparator ) ); }
/** {@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; }