/** * @see org.apache.xerces.xni.parser.XMLParserConfiguration#setErrorHandler(org.apache.xerces.xni.parser.XMLErrorHandler) */ @Override public void setErrorHandler(XMLErrorHandler errorHandler) { config.setErrorHandler(errorHandler); }
/** Default constructor. */ public DOMFragmentParser() { fParserConfiguration = new HTMLConfiguration(); fParserConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES); fParserConfiguration.addRecognizedProperties(RECOGNIZED_PROPERTIES); fParserConfiguration.setFeature(DOCUMENT_FRAGMENT, true); fParserConfiguration.setDocumentHandler(this); }
/** * @see org.apache.xerces.xni.parser.XMLParserConfiguration#parse(org.apache.xerces.xni.parser.XMLInputSource) */ @Override public void parse(XMLInputSource inputSource) throws XNIException, IOException { config.parse(inputSource); }
/** Default constructor. */ protected AbstractSAXParser(XMLParserConfiguration config) { super(config); config.addRecognizedFeatures(RECOGNIZED_FEATURES); config.addRecognizedProperties(RECOGNIZED_PROPERTIES); try { config.setFeature(ALLOW_UE_AND_NOTATION_EVENTS, false); } catch (XMLConfigurationException e) { // it wasn't a recognized feature, so we don't worry about it } } // <init>(XMLParserConfiguration)
/** Default constructor. */ public SchemaDOMParser(XMLParserConfiguration config) { this.config = config; config.setDocumentHandler(this); config.setDTDHandler(this); config.setDTDContentModelHandler(this); }
/** Default constructor. */ protected AbstractDOMParser (XMLParserConfiguration config) { super (config); // add recognized features fConfiguration.addRecognizedFeatures (RECOGNIZED_FEATURES); // set default values fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, true); fConfiguration.setFeature (INCLUDE_IGNORABLE_WHITESPACE, true); fConfiguration.setFeature (DEFER_NODE_EXPANSION, true); fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, true); fConfiguration.setFeature (CREATE_CDATA_NODES_FEATURE, true); // add recognized properties fConfiguration.addRecognizedProperties (RECOGNIZED_PROPERTIES); // set default values fConfiguration.setProperty (DOCUMENT_CLASS_NAME, DEFAULT_DOCUMENT_CLASS_NAME); } // <init>(XMLParserConfiguration)
parser.setFeature(NOTIFY_CHAR_REFS, true); parser.setFeature(NOTIFY_HTML_BUILTIN_REFS, true); String iencoding = null; String oencoding = "Windows-1252"; new XMLDocumentFilter[filtersVector.size()]; filtersVector.copyInto(filters); parser.setProperty(FILTERS, filters); XMLInputSource source = new XMLInputSource(null, arg, null); source.setEncoding(iencoding); parser.parse(source);
fSchemaValidationManager = new ValidationManager(); fUnparsedEntityHandler = new UnparsedEntityHandler(fSchemaValidationManager); config.setDTDHandler(fUnparsedEntityHandler); fUnparsedEntityHandler.setDTDHandler(xmlReader); xmlReader.setDTDSource(fUnparsedEntityHandler); fSchemaValidatorComponentManager = config; config.addRecognizedFeatures(validatorComponent.getRecognizedFeatures()); config.addRecognizedProperties(validatorComponent.getRecognizedProperties()); config.setDocumentHandler((XMLDocumentHandler) validatorComponent); ((XMLDocumentSource)validatorComponent).setDocumentHandler(xmlReader); xmlReader.setDocumentSource((XMLDocumentSource) validatorComponent);
if (fSymbolTable != null) fChildConfig.setProperty(SYMBOL_TABLE, fSymbolTable); if (fErrorReporter != null) fChildConfig.setProperty(ERROR_REPORTER, fErrorReporter); if (fEntityResolver != null) fChildConfig.setProperty(ENTITY_RESOLVER, fEntityResolver); fChildConfig.setProperty(SECURITY_MANAGER, fSecurityManager); fChildConfig.setProperty(BUFFER_SIZE, new Integer(fBufferSize)); fChildConfig.setProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY, fNamespaceContext); fChildConfig.setFeature( XINCLUDE_FIXUP_BASE_URIS, fFixupBaseURIs); fChildConfig.setFeature( XINCLUDE_FIXUP_LANGUAGE, fFixupLanguage); (XPointerHandler)fChildConfig.getProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.XPOINTER_HANDLER_PROPERTY); } else { XIncludeHandler newHandler = (XIncludeHandler)fChildConfig.getProperty( Constants.XERCES_PROPERTY_PREFIX + Constants.XINCLUDE_HANDLER_PROPERTY);
fConfiguration.getFeature (CREATE_ENTITY_REF_NODES); fConfiguration.getFeature (INCLUDE_IGNORABLE_WHITESPACE); fConfiguration.getFeature (DEFER_NODE_EXPANSION); fNamespaceAware = fConfiguration.getFeature (NAMESPACES); fIncludeComments = fConfiguration.getFeature (INCLUDE_COMMENTS_FEATURE); fCreateCDATANodes = fConfiguration.getFeature (CREATE_CDATA_NODES_FEATURE); fConfiguration.getProperty (DOCUMENT_CLASS_NAME));
/** * Delegates to SchemaParsingConfig.setProperty. * @param propertyId * @param value */ public void setProperty(String propertyId, Object value){ config.setProperty(propertyId, value); }
/** * @see org.apache.xerces.xni.parser.XMLParserConfiguration#getProperty(java.lang.String) */ @Override public Object getProperty(String propertyId) throws XMLConfigurationException { return config.getProperty(propertyId); }
try { if (name.equalsIgnoreCase (Constants.DOM_COMMENTS)) { fConfiguration.setFeature (INCLUDE_COMMENTS_FEATURE, state); fConfiguration.setFeature (NORMALIZE_DATA, state); fConfiguration.setFeature (CREATE_ENTITY_REF_NODES, state); fConfiguration.setFeature (DISALLOW_DOCTYPE_DECL_FEATURE, state); fConfiguration.setFeature (NAMESPACES, state); fConfiguration.setFeature(NAMESPACES, true); fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true); fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true); fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true); fConfiguration.setFeature(DYNAMIC_VALIDATION, false); fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false); fConfiguration.setFeature(NORMALIZE_DATA, false); fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false); fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, state); fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, state); fConfiguration.setFeature (VALIDATION_FEATURE, state); if (fSchemaType != Constants.NS_DTD) { fConfiguration.setFeature (XMLSCHEMA, state);
config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER)); config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER)); config.setProperty(SECURITY_MANAGER, fComponentManager.getProperty(SECURITY_MANAGER)); parser.reset(); config.setDocumentHandler(fSchemaValidator); fSchemaValidator.setDocumentHandler(parser); parser.setContentHandler(ser.asContentHandler()); config.parse(input);
/** * @see org.apache.xerces.xni.parser.XMLParserConfiguration#getFeature(java.lang.String) */ @Override public boolean getFeature(String featureId) throws XMLConfigurationException { return config.getFeature(featureId); }
/** * @see org.apache.xerces.xni.parser.XMLParserConfiguration#setFeature(java.lang.String, boolean) */ @Override public void setFeature(String featureId, boolean state) throws XMLConfigurationException { config.setFeature(featureId, state); }
/** * 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); } } // <init>(SymbolTable,XMLGrammarPool)
}; fConfiguration.addRecognizedFeatures (domRecognizedFeatures); fConfiguration.setFeature (DEFER_NODE_EXPANSION, false); fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true); fConfiguration.setFeature(Constants.DOM_WELLFORMED, true); fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true); fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true); fConfiguration.setFeature(NAMESPACES, true); fConfiguration.setFeature(DYNAMIC_VALIDATION, false); fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false); fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false); fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false); fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true); fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true); fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false); fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true); fConfiguration.setFeature (Constants.DOM_CERTIFIED, true); fConfiguration.setFeature ( NORMALIZE_DATA, false );
/** * Associate an <code>ASModel</code> with a document instance. This * <code>ASModel</code> will be used by the " * <code>validate-if-schema</code>" and " * <code>datatype-normalization</code>" options during the load of a new * <code>Document</code>. */ public void setAbstractSchema(ASModel abstractSchema) { // since the ASModel associated with this object is an attribute // according to the DOM IDL, we must obliterate anything // that was set before, rather than adding to it. // REVISIT: so shouldn't we attempt to clear the // grammarPool before adding stuff to it? - NG fAbstractSchema = (ASModelImpl)abstractSchema; // make sure the GrammarPool is properly initialized. XMLGrammarPool grammarPool = (XMLGrammarPool)fConfiguration.getProperty(StandardParserConfiguration.XMLGRAMMAR_POOL); // if there is no grammar pool, create one // REVISIT: ASBuilder should always create one. if (grammarPool == null) { // something's not right in this situation... grammarPool = new XMLGrammarPoolImpl(); fConfiguration.setProperty(StandardParserConfiguration.XMLGRAMMAR_POOL, grammarPool); } if (fAbstractSchema != null) { initGrammarPool(fAbstractSchema, grammarPool); } }
parserConfig.setErrorHandler( new XMLErrorHandler() { @SuppressWarnings("synthetic-access") @Override parserConfig.parse( source ); } catch ( Exception e ) { errors.add( new SchemaValidationEvent( e ) );