package com.ctc.wstx.sax;
import java.util.HashMap;
import javax.xml.XMLConstants;
public final class SAXFeature
{
public final static String STD_FEATURE_PREFIX = "http://xml.org/sax/features/";
final static HashMap <String,SAXFeature>sInstances = new HashMap<String,SAXFeature>();
final static SAXFeature EXTERNAL_GENERAL_ENTITIES = new SAXFeature("external-general-entities");
final static SAXFeature EXTERNAL_PARAMETER_ENTITIES = new SAXFeature("external-parameter-entities");
final static SAXFeature IS_STANDALONE = new SAXFeature("is-standalone");
final static SAXFeature LEXICAL_HANDLER_PARAMETER_ENTITIES = new SAXFeature("lexical-handler/parameter-entities");
final static SAXFeature NAMESPACES = new SAXFeature("namespaces");
final static SAXFeature NAMESPACE_PREFIXES = new SAXFeature("namespace-prefixes");
final static SAXFeature RESOLVE_DTD_URIS = new SAXFeature("resolve-dtd-uris");
final static SAXFeature STRING_INTERNING = new SAXFeature("string-interning");
final static SAXFeature UNICODE_NORMALIZATION_CHECKING = new SAXFeature("unicode-normalization-checking");
final static SAXFeature USE_ATTRIBUTES2 = new SAXFeature("use-attributes2");
final static SAXFeature USE_LOCATOR2 = new SAXFeature("use-locator2");
final static SAXFeature USE_ENTITY_RESOLVER2 = new SAXFeature("use-entity-resolver2");
final static SAXFeature VALIDATION = new SAXFeature("validation");
final static SAXFeature XMLNS_URIS = new SAXFeature("xmlns-uris");
final static SAXFeature XML_1_1 = new SAXFeature("xml-1.1");
final static SAXFeature JDK_SECURE_PROCESSING = new SAXFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
private final String mSuffix;
private SAXFeature(String suffix)
{
mSuffix = suffix;
sInstances.put(suffix, this);
}
public static SAXFeature findByUri(String uri)
{
if (uri.startsWith(STD_FEATURE_PREFIX)) {
return findBySuffix(uri.substring(STD_FEATURE_PREFIX.length()));
}
return findBySuffix(uri);
}
public static SAXFeature findBySuffix(String suffix)
{
return sInstances.get(suffix);
}
public String getSuffix() { return mSuffix; }
@Override
public String toString() { return STD_FEATURE_PREFIX + mSuffix; }
}