package com.ctc.wstx.sax;
import java.util.HashMap;
public final class SAXProperty
{
public final static String STD_PROPERTY_PREFIX = "http://xml.org/sax/properties/";
final static HashMap<String,SAXProperty> sInstances = new HashMap<String,SAXProperty>();
public final static SAXProperty DECLARATION_HANDLER = new SAXProperty("declaration-handler");
public final static SAXProperty DOCUMENT_XML_VERSION = new SAXProperty("document-xml-version");
public final static SAXProperty DOM_NODE = new SAXProperty("dom-node");
public final static SAXProperty LEXICAL_HANDLER = new SAXProperty("lexical-handler");
final static SAXProperty XML_STRING = new SAXProperty("xml-string");
private final String mSuffix;
private SAXProperty(String suffix)
{
mSuffix = suffix;
sInstances.put(suffix, this);
}
public static SAXProperty findByUri(String uri)
{
if (uri.startsWith(STD_PROPERTY_PREFIX)) {
return findBySuffix(uri.substring(STD_PROPERTY_PREFIX.length()));
}
return null;
}
public static SAXProperty findBySuffix(String suffix)
{
return sInstances.get(suffix);
}
public String getSuffix() { return mSuffix; }
@Override
public String toString() { return STD_PROPERTY_PREFIX + mSuffix; }
}