com.topologi.diffx.xml.esc.XMLEscapeFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j-diffx Show documentation
Show all versions of docx4j-diffx Show documentation
differencing of docx files
/*
* This file is part of the DiffX library.
*
* For licensing information please see the file license.txt included in the release.
* A copy of this licence can also be found at
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
package com.topologi.diffx.xml.esc;
/**
* Factory for XML escape classes.
*
* @author Christophe Lauret
* @version 7 March 2005
*/
public final class XMLEscapeFactory {
/**
* Prevents creation of instances.
*/
private XMLEscapeFactory() {
}
/**
* Returns an instance of a XML Escape based on the given encoding.
*
* This method returns null
if the encoding is not supported.
*
* @param encoding The encoding for which an escape implementation is requested.
*
* @return A XMLEscape
instance corresponding to the specified encoding
* or null
.
*/
public static XMLEscape getInstance(String encoding) {
if ("utf-8".equals(encoding)) return XMLEscapeUTF8.UTF8_ESCAPE;
if ("UTF-8".equals(encoding)) return XMLEscapeUTF8.UTF8_ESCAPE;
if ("ASCII".equals(encoding)) return XMLEscapeASCII.ASCII_ESCAPE;
else return null;
}
}