Fields Summary |
---|
private static final String | CONTINUE_AFTER_FATAL_ERROR |
protected static final String | SYMBOL_TABLEProperty identifier: symbol table. |
protected static final String | ERROR_REPORTERProperty identifier: error reporter. |
protected static final String | ERROR_HANDLERProperty identifier: error handler. |
protected static final String | ENTITY_RESOLVERProperty identifier: entity resolver. |
protected static final String | GRAMMAR_POOLProperty identifier: grammar pool . |
private static final Hashtable | KNOWN_LOADERS |
private static final String[] | RECOGNIZED_PROPERTIESRecognized properties. |
protected org.apache.xerces.util.SymbolTable | fSymbolTable |
protected org.apache.xerces.impl.XMLErrorReporter | fErrorReporter |
protected org.apache.xerces.xni.parser.XMLEntityResolver | fEntityResolver |
protected org.apache.xerces.xni.grammars.XMLGrammarPool | fGrammarPool |
protected Locale | fLocale |
private Hashtable | fLoaders |
private int | fModCount |
Methods Summary |
---|
private void | clearModCounts()
Enumeration loaders = fLoaders.elements();
while (loaders.hasMoreElements()) {
XMLGrammarLoaderContainer xglc = (XMLGrammarLoaderContainer) loaders.nextElement();
xglc.modCount = 0;
}
fModCount = 1;
|
public org.apache.xerces.xni.parser.XMLEntityResolver | getEntityResolver()Returns the registered entity resolver.
return fEntityResolver;
|
public org.apache.xerces.xni.parser.XMLErrorHandler | getErrorHandler()Returns the registered error handler.
return fErrorReporter.getErrorHandler();
|
public boolean | getFeature(java.lang.String type, java.lang.String featureId)
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)fLoaders.get(type)).loader;
return gl.getFeature(featureId);
|
public org.apache.xerces.xni.grammars.XMLGrammarPool | getGrammarPool()Returns the registered grammar pool.
return fGrammarPool;
|
public org.apache.xerces.xni.grammars.XMLGrammarLoader | getLoader(java.lang.String type)
XMLGrammarLoaderContainer xglc = (XMLGrammarLoaderContainer) fLoaders.get(type);
return (xglc != null) ? xglc.loader : null;
|
public java.util.Locale | getLocale()Return the Locale the XMLGrammarLoader is using.
return fLocale;
|
public java.lang.Object | getProperty(java.lang.String type, java.lang.String propertyId)
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)fLoaders.get(type)).loader;
return gl.getProperty(propertyId);
|
public org.apache.xerces.xni.grammars.Grammar | preparseGrammar(java.lang.String type, org.apache.xerces.xni.parser.XMLInputSource is)Parse a grammar from a location identified by an
XMLInputSource.
This method also adds this grammar to the XMLGrammarPool
if (fLoaders.containsKey(type)) {
XMLGrammarLoaderContainer xglc = (XMLGrammarLoaderContainer) fLoaders.get(type);
XMLGrammarLoader gl = xglc.loader;
if (xglc.modCount != fModCount) {
// make sure gl's been set up with all the "basic" properties:
gl.setProperty(SYMBOL_TABLE, fSymbolTable);
gl.setProperty(ENTITY_RESOLVER, fEntityResolver);
gl.setProperty(ERROR_REPORTER, fErrorReporter);
// potentially, not all will support this one...
if (fGrammarPool != null) {
try {
gl.setProperty(GRAMMAR_POOL, fGrammarPool);
} catch(Exception e) {
// too bad...
}
}
xglc.modCount = fModCount;
}
return gl.loadGrammar(is);
}
return null;
|
public boolean | registerPreparser(java.lang.String grammarType, org.apache.xerces.xni.grammars.XMLGrammarLoader loader)
if(loader == null) { // none specified!
if(KNOWN_LOADERS.containsKey(grammarType)) {
// got one; just instantiate it...
String loaderName = (String)KNOWN_LOADERS.get(grammarType);
try {
ClassLoader cl = ObjectFactory.findClassLoader();
XMLGrammarLoader gl = (XMLGrammarLoader)(ObjectFactory.newInstance(loaderName, cl, true));
fLoaders.put(grammarType, new XMLGrammarLoaderContainer(gl));
} catch (Exception e) {
return false;
}
return true;
}
return false;
}
// were given one
fLoaders.put(grammarType, new XMLGrammarLoaderContainer(loader));
return true;
|
public void | setEntityResolver(org.apache.xerces.xni.parser.XMLEntityResolver entityResolver)Sets the entity resolver.
if (fEntityResolver != entityResolver) {
// Overflow. We actually need to reset the
// modCount on every XMLGrammarLoaderContainer.
if (++fModCount < 0) {
clearModCounts();
}
fEntityResolver = entityResolver;
}
|
public void | setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler errorHandler)Sets the error handler.
fErrorReporter.setProperty(ERROR_HANDLER, errorHandler);
|
public void | setFeature(java.lang.String featureId, boolean value)
Enumeration loaders = fLoaders.elements();
while (loaders.hasMoreElements()) {
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)loaders.nextElement()).loader;
try {
gl.setFeature(featureId, value);
} catch(Exception e) {
// eat it up...
}
}
// since our error reporter is a property we set later,
// make sure features it understands are also set.
if(featureId.equals(CONTINUE_AFTER_FATAL_ERROR)) {
fErrorReporter.setFeature(CONTINUE_AFTER_FATAL_ERROR, value);
}
|
public void | setGrammarPool(org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool)Sets the grammar pool.
if (fGrammarPool != grammarPool) {
// Overflow. We actually need to reset the
// modCount on every XMLGrammarLoaderContainer.
if (++fModCount < 0) {
clearModCounts();
}
fGrammarPool = grammarPool;
}
|
public void | setLocale(java.util.Locale locale)Set the locale to use for messages.
fLocale = locale;
|
public void | setProperty(java.lang.String propId, java.lang.Object value)
Enumeration loaders = fLoaders.elements();
while (loaders.hasMoreElements()) {
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)loaders.nextElement()).loader;
try {
gl.setProperty(propId, value);
} catch(Exception e) {
// eat it up...
}
}
|