本文整理汇总了Java中org.apache.xerces.xni.grammars.XMLGrammarPool类的典型用法代码示例。如果您正苦于以下问题:Java XMLGrammarPool类的具体用法?Java XMLGrammarPool怎么用?Java XMLGrammarPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLGrammarPool类属于org.apache.xerces.xni.grammars包,在下文中一共展示了XMLGrammarPool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValidatorImpl
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
ValidatorImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool, PropertyMap properties) {
this.symbolTable = symbolTable;
XMLErrorHandler errorHandlerWrapper = new ErrorHandlerWrapper(properties.get(ValidateProperty.ERROR_HANDLER));
components = new XMLComponent[] { errorReporter, schemaValidator, entityManager };
for (int i = 0; i < components.length; i++) {
addRecognizedFeatures(components[i].getRecognizedFeatures());
addRecognizedProperties(components[i].getRecognizedProperties());
}
addRecognizedFeatures(recognizedFeatures);
addRecognizedProperties(recognizedProperties);
setFeature(Features.SCHEMA_AUGMENT_PSVI, false);
setFeature(Features.SCHEMA_FULL_CHECKING, true);
setFeature(Features.VALIDATION, true);
setFeature(Features.SCHEMA_VALIDATION, true);
setFeature(Features.ID_IDREF_CHECKING, true);
setFeature(Features.IDC_CHECKING, true);
setProperty(Properties.XMLGRAMMAR_POOL, grammarPool);
setProperty(Properties.SYMBOL_TABLE, symbolTable);
errorReporter.setDocumentLocator(this);
setProperty(Properties.ERROR_REPORTER, errorReporter);
setProperty(Properties.ERROR_HANDLER, errorHandlerWrapper);
setProperty(Properties.VALIDATION_MANAGER, validationManager);
setProperty(Properties.ENTITY_MANAGER, entityManager);
setProperty(Properties.ENTITY_RESOLVER, this);
reset();
}
示例2: SAXParserMMImpl
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a SAX parser using the specified symbol table and
* grammar pool.
*/
public SAXParserMMImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
// modified by rsun 11/06/03 - use XML11ConfigurationMMImpl instead
// of XML11ConfigurationImpl
super((XMLParserConfiguration)ObjectFactory.createObject(
"org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.XML11ConfigurationMMImpl"
));
// set features
fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES);
fConfiguration.setFeature(NOTIFY_BUILTIN_REFS, true);
// set properties
fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES);
if (symbolTable != null) {
fConfiguration.setProperty(SYMBOL_TABLE, symbolTable);
}
if (grammarPool != null) {
fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool);
}
}
示例3: SAXParser
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a SAX parser using the specified symbol table and
* grammar pool.
*/
public SAXParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
super((XMLParserConfiguration)ObjectFactory.createObject(
"org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.XIncludeAwareParserConfiguration"
));
// set features
fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES);
fConfiguration.setFeature(NOTIFY_BUILTIN_REFS, true);
// set properties
fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES);
if (symbolTable != null) {
fConfiguration.setProperty(SYMBOL_TABLE, symbolTable);
}
if (grammarPool != null) {
fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool);
}
}
示例4: DOMParser
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a DOM parser using the specified symbol table and
* grammar pool.
*/
public DOMParser(SymbolTable symbolTable, XMLGrammarPool grammarPool) {
super((XMLParserConfiguration)ObjectFactory.createObject(
"org.apache.xerces.xni.parser.XMLParserConfiguration",
"org.apache.xerces.parsers.XIncludeAwareParserConfiguration"
));
// set properties
fConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES);
if (symbolTable != null) {
fConfiguration.setProperty(SYMBOL_TABLE, symbolTable);
}
if (grammarPool != null) {
fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool);
}
}
示例5: XMLGrammarCachingConfiguration
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
* <strong>REVISIT:</strong>
* Grammar pool will be updated when the new validation engine is
* implemented.
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public XMLGrammarCachingConfiguration(SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
// REVISIT: may need to add some features/properties
// specific to this configuration at some point...
// add default recognized features
// set state for default features
// add default recognized properties
// create and register missing components
fSchemaLoader = new XMLSchemaLoader(fSymbolTable);
fSchemaLoader.setProperty(XMLGRAMMAR_POOL, fGrammarPool);
// and set up the DTD loader too:
fDTDLoader = new XMLDTDLoader(fSymbolTable, fGrammarPool);
}
示例6: SchemaImpl
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
SchemaImpl(SymbolTable symbolTable,
XMLGrammarPool grammarPool,
PropertyMap properties,
PropertyId<?>[] supportedPropertyIds) {
super(properties, supportedPropertyIds);
this.symbolTable = symbolTable;
this.grammarPool = grammarPool;
}
示例7: createSchema
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
public Schema createSchema(SAXSource source, PropertyMap properties)
throws IOException, SAXException, IncorrectSchemaException {
SymbolTable symbolTable = new SymbolTable();
XMLGrammarPreparser preparser = new XMLGrammarPreparser(symbolTable);
XMLGrammarPool grammarPool = new XMLGrammarPoolImpl();
preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
preparser.setGrammarPool(grammarPool);
ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
SAXXMLErrorHandler xeh = new SAXXMLErrorHandler(eh);
preparser.setErrorHandler(xeh);
EntityResolver er = properties.get(ValidateProperty.ENTITY_RESOLVER);
if (er != null)
preparser.setEntityResolver(new EntityResolverWrapper(er));
try {
preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, toXMLInputSource(source.getInputSource()));
Name attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
if (attributeOwner != null) {
Reader r = new StringReader(createWrapper(attributeOwner));
preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,
new XMLInputSource(null, null, null, r, null));
}
}
catch (XNIException e) {
throw ValidatorImpl.toSAXException(e);
}
if (xeh.getHadError())
throw new IncorrectSchemaException();
return new SchemaImpl(new SynchronizedSymbolTable(symbolTable),
new CachingParserPool.SynchronizedGrammarPool(grammarPool),
properties,
supportedPropertyIds);
}
示例8: IntegratedParserConfigurationMMImpl
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
* <strong>REVISIT:</strong>
* Grammar pool will be updated when the new validation engine is
* implemented.
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public IntegratedParserConfigurationMMImpl(SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
// create components
fNonNSScanner = new XMLDocumentScannerImpl();
fNonNSDTDValidator = new XMLDTDValidator();
// add components
addComponent((XMLComponent)fNonNSScanner);
addComponent((XMLComponent)fNonNSDTDValidator);
}
示例9: XPointerParserConfiguration
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public XPointerParserConfiguration(
SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
fXIncludeHandler = new XIncludeHandler();
addCommonComponent(fXIncludeHandler);
fXPointerHandler = new XPointerHandler();
addCommonComponent(fXPointerHandler);
final String[] recognizedFeatures = {
ALLOW_UE_AND_NOTATION_EVENTS,
XINCLUDE_FIXUP_BASE_URIS,
XINCLUDE_FIXUP_LANGUAGE
};
addRecognizedFeatures(recognizedFeatures);
// add default recognized properties
final String[] recognizedProperties =
{ XINCLUDE_HANDLER, XPOINTER_HANDLER, NAMESPACE_CONTEXT };
addRecognizedProperties(recognizedProperties);
setFeature(ALLOW_UE_AND_NOTATION_EVENTS, true);
setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
setProperty(XINCLUDE_HANDLER, fXIncludeHandler);
setProperty(XPOINTER_HANDLER, fXPointerHandler);
setProperty(NAMESPACE_CONTEXT, new XIncludeNamespaceSupport());
}
示例10: initGrammarPool
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
private void initGrammarPool(ASModelImpl currModel, XMLGrammarPool grammarPool) {
// put all the grammars in fAbstractSchema into the grammar pool.
// grammarPool must never be null!
Grammar[] grammars = new Grammar[1];
if ((grammars[0] = (Grammar)currModel.getGrammar()) != null) {
grammarPool.cacheGrammars(grammars[0].getGrammarDescription().getGrammarType(), grammars);
}
Vector modelStore = currModel.getInternalASModels();
for (int i = 0; i < modelStore.size(); i++) {
initGrammarPool((ASModelImpl)modelStore.elementAt(i), grammarPool);
}
}
示例11: createDOMParser
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/** Creates a new DOM parser. */
public DOMParser createDOMParser() {
SymbolTable symbolTable = fShadowSymbolTable
? new ShadowedSymbolTable(fSynchronizedSymbolTable)
: fSynchronizedSymbolTable;
XMLGrammarPool grammarPool = fShadowGrammarPool
? new ShadowedGrammarPool(fSynchronizedGrammarPool)
: fSynchronizedGrammarPool;
return new DOMParser(symbolTable, grammarPool);
}
示例12: createSAXParser
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/** Creates a new SAX parser. */
public SAXParser createSAXParser() {
SymbolTable symbolTable = fShadowSymbolTable
? new ShadowedSymbolTable(fSynchronizedSymbolTable)
: fSynchronizedSymbolTable;
XMLGrammarPool grammarPool = fShadowGrammarPool
? new ShadowedGrammarPool(fSynchronizedGrammarPool)
: fSynchronizedGrammarPool;
return new SAXParser(symbolTable, grammarPool);
}
示例13: setGrammarPool
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Sets the grammar pool.
*
* @param grammarPool The new grammar pool.
*/
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;
}
}
示例14: XIncludeParserConfiguration
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public XIncludeParserConfiguration(
SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
fXIncludeHandler = new XIncludeHandler();
addCommonComponent(fXIncludeHandler);
final String[] recognizedFeatures = {
ALLOW_UE_AND_NOTATION_EVENTS,
XINCLUDE_FIXUP_BASE_URIS,
XINCLUDE_FIXUP_LANGUAGE
};
addRecognizedFeatures(recognizedFeatures);
// add default recognized properties
final String[] recognizedProperties =
{ XINCLUDE_HANDLER, NAMESPACE_CONTEXT };
addRecognizedProperties(recognizedProperties);
setFeature(ALLOW_UE_AND_NOTATION_EVENTS, true);
setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
setProperty(XINCLUDE_HANDLER, fXIncludeHandler);
setProperty(NAMESPACE_CONTEXT, new XIncludeNamespaceSupport());
}
示例15: XIncludeAwareParserConfiguration
import org.apache.xerces.xni.grammars.XMLGrammarPool; //导入依赖的package包/类
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public XIncludeAwareParserConfiguration(
SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
final String[] recognizedFeatures = {
ALLOW_UE_AND_NOTATION_EVENTS,
XINCLUDE_FIXUP_BASE_URIS,
XINCLUDE_FIXUP_LANGUAGE
};
addRecognizedFeatures(recognizedFeatures);
// add default recognized properties
final String[] recognizedProperties =
{ XINCLUDE_HANDLER, NAMESPACE_CONTEXT };
addRecognizedProperties(recognizedProperties);
setFeature(ALLOW_UE_AND_NOTATION_EVENTS, true);
setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
fNonXIncludeNSContext = new NamespaceSupport();
fCurrentNSContext = fNonXIncludeNSContext;
setProperty(NAMESPACE_CONTEXT, fNonXIncludeNSContext);
}