com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl

Here are the examples of the java api class com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl taken from open source projects.

1. DOMNormalizer#createGrammarPool()

Project: openjdk
Source File: DOMNormalizer.java
View license
//normalizeNode
private XMLGrammarPool createGrammarPool(DocumentTypeImpl docType) {
    XMLGrammarPoolImpl pool = new XMLGrammarPoolImpl();
    XMLGrammarPreparser preParser = new XMLGrammarPreparser(fSymbolTable);
    preParser.registerPreparser(XMLGrammarDescription.XML_DTD, null);
    preParser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true);
    preParser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATION_FEATURE, true);
    preParser.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY, pool);
    String internalSubset = docType.getInternalSubset();
    XMLInputSource is = new XMLInputSource(docType.getPublicId(), docType.getSystemId(), null, false);
    if (internalSubset != null)
        is.setCharacterStream(new StringReader(internalSubset));
    try {
        DTDGrammar g = (DTDGrammar) preParser.preparseGrammar(XMLGrammarDescription.XML_DTD, is);
        ((XMLDTDDescription) g.getGrammarDescription()).setRootName(docType.getName());
        is.setCharacterStream(null);
        g = (DTDGrammar) preParser.preparseGrammar(XMLGrammarDescription.XML_DTD, is);
        ((XMLDTDDescription) g.getGrammarDescription()).setRootName(docType.getName());
    } catch (XNIException e) {
    } catch (IOException e) {
    }
    return pool;
}