public void setLineEmpty( final boolean lineEmpty ) { support.setLineEmpty( lineEmpty ); }
/** * Writes some text to the character stream. * * @param text the text. * @throws IOException if there is a problem writing to the character stream. */ public void writeText( final String text ) throws IOException { this.writer.write( text ); support.setLineEmpty( false ); }
/** * Writes a linebreak to the writer. * * @param writer the writer. * @throws IOException if there is a problem writing to the character stream. */ public void writeNewLine( final Writer writer ) throws IOException { if ( isLineEmpty() == false ) { writer.write( lineSeparator ); setLineEmpty( true ); } }
/** * Copies the given reader to the character stream. This method should be used for large chunks of data. * * @param reader the reader providing the text. * @throws IOException if there is a problem writing to the character stream. */ public void writeStream( final Reader reader ) throws IOException { IOUtils.getInstance().copyWriter( reader, writer ); support.setLineEmpty( false ); }
/** * Writes a closing XML tag. * * @param w the writer. * @throws java.io.IOException if there is an I/O problem. */ public void writeCloseTag( final Writer w ) throws IOException { indentForClose( w ); final ElementLevel level = (ElementLevel) openTags.pop(); setLineEmpty( false ); w.write( "</" ); final String prefix = level.getPrefix(); if ( prefix != null ) { w.write( prefix ); w.write( ":" ); w.write( level.getTagName() ); } else { w.write( level.getTagName() ); } w.write( ">" ); doEndOfLine( w ); }
/** * Writes a comment into the generated xml file. * * @param writer the writer. * @param comment the comment text * @throws IOException if there is a problem writing to the character stream. */ public void writeComment( final Writer writer, final String comment ) throws IOException { if ( openTags.isEmpty() == false ) { final ElementLevel level = (ElementLevel) openTags.peek(); if ( getTagDescription().hasCData( level.getNamespace(), level.getTagName() ) == false ) { indent( writer ); } } setLineEmpty( false ); writer.write( "<!-- " ); writeTextNormalized( writer, comment, false ); writer.write( " -->" ); doEndOfLine( writer ); }