All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kefirsf.bb.EscapeXmlProcessorFactory Maven / Gradle / Ivy

Go to download

KefirBB is a Java-library for text processing. Initially it was developed for BB2HTML translation. But flexible configuration allows to use it in different cases. For example for parsing Markdown, Textile, and for HTML filtration.

The newest version!
package org.kefirsf.bb;

/**
 * The class for creating the escape xml special symbols processor. It's processor change:
 *
 * & to &
 * ' to '
 * < to &lt;
 * > to &gt;
 * " to &quot;
 *
 * @author Kefir
 */
public class EscapeXmlProcessorFactory implements TextProcessorFactory {
    /**
     * The default XML escape symbols
     */
    private static final String[][] DEFAULT_ESCAPE_XML = {
            {"&", "&"},
            {"'", "'"},
            {">", ">"},
            {"<", "<"},
            {"\"", """}
    };

    /**
     * Instance of processor.
     */
    private static final TextProcessor processor = new EscapeProcessor(DEFAULT_ESCAPE_XML);

    /**
     * Instance of factory
     */
    private static final TextProcessorFactory instance = new EscapeXmlProcessorFactory();

    /**
     * Private constructor. Because this class is singleton.
     */
    private EscapeXmlProcessorFactory() {
    }

    /**
     * Return instance of this class.
     *
     * @return instance of escape xml processor factory
     */
    public static TextProcessorFactory getInstance() {
        return instance;
    }

    /**
     * Create the new XML escape symbols processor.
     *
     * @see TextProcessorFactory#create()
     */
    public TextProcessor create() {
        return processor;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy