/** * Gets the character entity parser for HTML content. The CharacterEntity parser translates known characters into * predefined entities. * * @return the character entity parser instance. */ public static synchronized CharacterEntityParser getEntityParser() { if ( entityParser == null ) { entityParser = new CharacterEntityParser( new HtmlCharacterEntities() ); } return entityParser; }
public void close() throws IOException { // close all .. xmlWriter.writeCloseTag(); xmlWriter.close(); }
/** * Creates and configures a new TagDescription collection. * * @param conf the configuration. * @param prefix the key-prefix. * @see #configure(Configuration, String) */ public DefaultTagDescription( final Configuration conf, final String prefix ) { this(); configure( conf, prefix ); }
/** * Default Constructor. The created XMLWriterSupport will not have no safe tags and starts with an indention level of * 0. */ public XmlWriterSupport() { this( new DefaultTagDescription(), " " ); }
private void writeAnchors( final XmlWriter xmlWriter, final ReportElement realBackground ) throws IOException { if ( realBackground != null ) { final String[] anchors = new String[0]; // realBackground.getAnchors(); for ( int i = 0; i < anchors.length; i++ ) { final String anchor = anchors[i]; xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor, XmlWriterSupport.CLOSE ); } } }
public void setNamespaceHasCData( final String namespaceUri, final boolean hasCData ) { writerTagDescription.setNamespaceHasCData( namespaceUri, hasCData ); }
/** * Normalizes the given string using a shared buffer. * * @param s the string that should be XML-Encoded. * @param transformNewLine a flag controling whether to transform newlines into character-entities. * @return the transformed string. */ public String normalizeLocal( final String s, final boolean transformNewLine ) throws IOException { return normalize( s, transformNewLine ); }
/** * Writes the given text into the stream using a streaming xml-normalization method. * * @param s the string to be written. * @param transformNewLine whether to encode newlines using character-entities. * @throws IOException if an IO error occured. */ public void writeTextNormalized( final String s, final boolean transformNewLine ) throws IOException { support.writeTextNormalized( writer, s, transformNewLine ); }
/** * Writes a linebreak to the writer. * * @throws IOException if there is a problem writing to the character stream. */ public void writeNewLine() throws IOException { support.writeNewLine( writer ); }
/** * Writes the XML declaration that usually appears at the top of every XML file. * * @param encoding the encoding that should be declared (this has to match the encoding of the writer, or funny things * may happen when parsing the xml file later). * @throws java.io.IOException if there is a problem writing to the character stream. */ public void writeXmlDeclaration( final String encoding ) throws IOException { support.writeXmlDeclaration( writer, encoding ); }
/** * Writes a comment into the generated xml file. * * @param comment the comment text * @throws IOException if there is a problem writing to the character stream. */ public void writeComment( final String comment ) throws IOException { support.writeComment( writer, comment ); }
/** * Writes a closing XML tag. * * @throws java.io.IOException if there is an I/O problem. */ public void writeCloseTag() throws IOException { support.writeCloseTag( this.writer ); }
public DefaultTagDescription createWriterTagDescription() { return writerTagDescription.clone(); } }
public TagDescription getTagDescription() { return support.getTagDescription(); } }
public void setWriteFinalLinebreak( final boolean writeFinalLinebreak ) { support.setWriteFinalLinebreak( writeFinalLinebreak ); }
public boolean isNamespacePrefixDefined( final String prefix ) { return support.isNamespacePrefixDefined( prefix ); }
public int getAdditionalIndent() { return support.getAdditionalIndent(); }
public void close() throws IOException { // close all .. xmlWriter.writeCloseTag(); xmlWriter.close(); }
/** * Creates a new XML writer for the specified character stream. * * @param writer the character stream. * @param indentString the string used for indentation (should contain white space, for example four spaces). */ public XmlWriter( final Writer writer, final String indentString ) { this( writer, new DefaultTagDescription(), indentString ); }
/** * Normalizes the given string and writes the result directly to the stream. * * @param writer the writer that should receive the normalized content. * @param s the string that should be XML-Encoded. * @param transformNewLine a flag controling whether to transform newlines into character-entities. * @throws IOException if writing to the stream failed. */ public void writeTextNormalized( final Writer writer, final String s, final boolean transformNewLine ) throws IOException { writeTextNormalized( writer, s, charsetEncoder, transformNewLine ); }