public void setFeature(String featureId, boolean state) throws XMLConfigurationException { if (featureId.equals(XINCLUDE_FEATURE)) { fXIncludeEnabled = state; fConfigUpdated = true; return; } super.setFeature(featureId,state); }
synchronized SAXParser getSAXParser() { if (fSAXParser != null) { SAXParser parser = (SAXParser) fSAXParser.get(); if (parser != null) { return parser; } } // REVISIT: when schema handles XML 1.1, will need to // revisit this (and the practice of not prepending an XML decl to the annotation string XML11Configuration config = new XML11Configuration(fSymbolTable); // note that this should never produce errors or require // entity resolution, so just a barebones configuration with // a couple of feature set will do fine config.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true); config.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE, false); SAXParser parser = new SAXParser(config); fSAXParser = new SoftReference(parser); return parser; }
synchronized DOMParser getDOMParser() { if (fDOMParser != null) { DOMParser parser = (DOMParser) fDOMParser.get(); if (parser != null) { return parser; } } // REVISIT: when schema handles XML 1.1, will need to // revisit this (and the practice of not prepending an XML decl to the annotation string XML11Configuration config = new XML11Configuration(fSymbolTable); // note that this should never produce errors or require // entity resolution, so just a barebones configuration with // a couple of feature set will do fine config.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true); config.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE, false); DOMParser parser = new DOMParser(config); try { parser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.DEFER_NODE_EXPANSION_FEATURE, false); } catch (SAXException exc) {} fDOMParser = new SoftReference(parser); return parser; }
private void createAnnotationValidator() { fAnnotationValidator = new XML11Configuration(); fGrammarBucketAdapter = new XSAnnotationGrammarPool(fSchemaVersion); fAnnotationValidator.setFeature(VALIDATION, true); fAnnotationValidator.setFeature(XMLSCHEMA_VALIDATION, true); fAnnotationValidator.setProperty(XMLGRAMMAR_POOL, fGrammarBucketAdapter); /** Set error handler. **/ XMLErrorHandler errorHandler = fErrorReporter.getErrorHandler(); fAnnotationValidator.setProperty(ERROR_HANDLER, (errorHandler != null) ? errorHandler : new DefaultErrorHandler()); /** Set locale. **/ Locale locale = fErrorReporter.getLocale(); fAnnotationValidator.setProperty(LOCALE, locale); }