org.kefirsf.bb.EscapeXmlProcessorFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kefirbb Show documentation
Show all versions of kefirbb Show documentation
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 <
* > to >
* " to "
*
* @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