Method from org.apache.xerces.parsers.XMLGrammarPreparser Detail: |
public XMLEntityResolver getEntityResolver() {
return fEntityResolver;
}
Returns the registered entity resolver. |
public XMLErrorHandler getErrorHandler() {
return fErrorReporter.getErrorHandler();
}
Returns the registered error handler. |
public boolean getFeature(String type,
String featureId) {
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)fLoaders.get(type)).loader;
return gl.getFeature(featureId);
}
|
public XMLGrammarPool getGrammarPool() {
return fGrammarPool;
}
Returns the registered grammar pool. |
public XMLGrammarLoader getLoader(String type) {
XMLGrammarLoaderContainer xglc = (XMLGrammarLoaderContainer) fLoaders.get(type);
return (xglc != null) ? xglc.loader : null;
}
|
public Locale getLocale() {
return fLocale;
}
Return the Locale the XMLGrammarLoader is using. |
public Object getProperty(String type,
String propertyId) {
XMLGrammarLoader gl = ((XMLGrammarLoaderContainer)fLoaders.get(type)).loader;
return gl.getProperty(propertyId);
}
|
public Grammar preparseGrammar(String type,
XMLInputSource is) throws IOException, XNIException {
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;
}
Parse a grammar from a location identified by an
XMLInputSource.
This method also adds this grammar to the XMLGrammarPool |
public boolean registerPreparser(String grammarType,
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(XMLEntityResolver entityResolver) {
if (fEntityResolver != entityResolver) {
// Overflow. We actually need to reset the
// modCount on every XMLGrammarLoaderContainer.
if (++fModCount < 0) {
clearModCounts();
}
fEntityResolver = entityResolver;
}
}
Sets the entity resolver. |
public void setErrorHandler(XMLErrorHandler errorHandler) {
fErrorReporter.setProperty(ERROR_HANDLER, errorHandler);
}
|
public void setFeature(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(XMLGrammarPool grammarPool) {
if (fGrammarPool != grammarPool) {
// Overflow. We actually need to reset the
// modCount on every XMLGrammarLoaderContainer.
if (++fModCount < 0) {
clearModCounts();
}
fGrammarPool = grammarPool;
}
}
|
public void setLocale(Locale locale) {
fLocale = locale;
}
Set the locale to use for messages. |
public void setProperty(String propId,
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...
}
}
}
|