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 SymbolTable | fSymbolTable |
protected XMLErrorReporter | fErrorReporter |
protected XMLEntityResolver | fEntityResolver |
protected XMLGrammarPool | fGrammarPool |
protected Locale | fLocale |
private Hashtable | fLoaders |
Methods Summary |
---|
public com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver | getEntityResolver()Returns the registered entity resolver.
return fEntityResolver;
|
public com.sun.org.apache.xerces.internal.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 = (XMLGrammarLoader)fLoaders.get(type);
return gl.getFeature(featureId);
|
public com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool | getGrammarPool()Returns the registered grammar pool.
return fGrammarPool;
|
public com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarLoader | getLoader(java.lang.String type)
return (XMLGrammarLoader)fLoaders.get(type);
|
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 = (XMLGrammarLoader)fLoaders.get(type);
return gl.getProperty(propertyId);
|
public com.sun.org.apache.xerces.internal.xni.grammars.Grammar | preparseGrammar(java.lang.String type, com.sun.org.apache.xerces.internal.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)) {
XMLGrammarLoader gl = (XMLGrammarLoader)fLoaders.get(type);
// 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...
}
}
return gl.loadGrammar(is);
}
return null;
|
public boolean | registerPreparser(java.lang.String grammarType, com.sun.org.apache.xerces.internal.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, gl);
} catch (Exception e) {
return false;
}
return true;
}
return false;
}
// were given one
fLoaders.put(grammarType, loader);
return true;
|
public void | setEntityResolver(com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver entityResolver)Sets the entity resolver.
fEntityResolver = entityResolver;
|
public void | setErrorHandler(com.sun.org.apache.xerces.internal.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 = (XMLGrammarLoader)loaders.nextElement();
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(com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool grammarPool)Sets the grammar pool.
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 = (XMLGrammarLoader)loaders.nextElement();
try {
gl.setProperty(propId, value);
} catch(Exception e) {
// eat it up...
}
}
|