private void setErrorReporter(XMLErrorReporter reporter) { fErrorReporter = reporter; if (fErrorReporter != null) { fErrorReporter.putMessageFormatter( XIncludeMessageFormatter.XINCLUDE_DOMAIN, fXIncludeMessageFormatter); // this ensures the proper location is displayed in error messages if (fDocLocation != null) { fErrorReporter.setDocumentLocator(fDocLocation); } } }
/** * Initializes error handling objects */ protected void initErrorReporter() { if (fErrorReporter == null) { fErrorReporter = new XMLErrorReporter(); } if (fErrorHandler == null) { fErrorHandler = new XPointerErrorHandler(); } fErrorReporter.putMessageFormatter( XPointerMessageFormatter.XPOINTER_DOMAIN, new XPointerMessageFormatter()); }
fErrorReporter = (XMLErrorReporter)state; if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) { fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
/** * Initializes error handling objects * */ protected void initErrorReporter() { if (fXPointerErrorReporter == null) { fXPointerErrorReporter = new XMLErrorReporter(); } if (fErrorHandler == null) { fErrorHandler = new XPointerErrorHandler(); } /* fXPointerErrorReporter.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY, fErrorHandler); */ fXPointerErrorReporter.putMessageFormatter( XPointerMessageFormatter.XPOINTER_DOMAIN, new XPointerMessageFormatter()); }
public SchemaValidatorConfiguration(XMLComponentManager parentManager, XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) { fParentComponentManager = parentManager; fGrammarPool = grammarContainer.getGrammarPool(); fUseGrammarPoolOnly = grammarContainer.isFullyComposed(); fValidationManager = validationManager; // add schema message formatter to error reporter try { XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER); if (errorReporter != null) { errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter()); } } // Ignore exception. catch (XMLConfigurationException exc) {} }
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
XMLDTDLoader(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver) { fSymbolTable = symbolTable; fGrammarPool = grammarPool; if(errorReporter == null) { errorReporter = new XMLErrorReporter(); errorReporter.setProperty(ERROR_HANDLER, new DefaultErrorHandler()); } fErrorReporter = errorReporter; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fEntityResolver = entityResolver; if(fEntityResolver instanceof XMLEntityManager) { fEntityManager = (XMLEntityManager)fEntityResolver; } else { fEntityManager = new XMLEntityManager(); } fEntityManager.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY, errorReporter); fDTDScanner = createDTDScanner(fSymbolTable, fErrorReporter, fEntityManager); fDTDScanner.setDTDHandler(this); fDTDScanner.setDTDContentModelHandler(this); reset(); } // init(SymbolTable, XMLGrammarPool, XMLErrorReporter, XMLEntityResolver)
/** Configures the pipeline. */ protected void configurePipeline() { super.configurePipeline(); if ( getFeature(XMLSCHEMA_VALIDATION )) { // If schema validator was not in the pipeline insert it. if (fSchemaValidator == null) { fSchemaValidator = new XMLSchemaValidator(); // add schema component fProperties.put(SCHEMA_VALIDATOR, fSchemaValidator); addComponent(fSchemaValidator); // add schema message formatter if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) { XSMessageFormatter xmft = new XSMessageFormatter(); fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft); } } fLastComponent = fSchemaValidator; fNamespaceBinder.setDocumentHandler(fSchemaValidator); fSchemaValidator.setDocumentHandler(fDocumentHandler); fSchemaValidator.setDocumentSource(fNamespaceBinder); } } // configurePipeline()
private XMLParserConfiguration initialize() { XML11Configuration config = new XML11Configuration(); config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER)); config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER)); XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER); config.setProperty(ERROR_REPORTER, errorReporter); // add message formatters if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE)); config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER)); config.setProperty(SECURITY_MANAGER, fComponentManager.getProperty(SECURITY_MANAGER)); config.setDocumentHandler(fSchemaValidator); config.setDTDHandler(null); config.setDTDContentModelHandler(null); fConfiguration = new SoftReference(config); return config; }
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
SchemaGrammar parseXMLSchema(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fSchemaLoader.setEntityResolver(resolver); } if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) { fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter()); } fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter); String propPrefix = Constants.XERCES_PROPERTY_PREFIX; String propName = propPrefix + Constants.SCHEMA_LOCATION; fSchemaLoader.setProperty(propName, getProperty(propName)); propName = propPrefix + Constants.SCHEMA_NONS_LOCATION; fSchemaLoader.setProperty(propName, getProperty(propName)); propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE; fSchemaLoader.setProperty(propName, getProperty(propName)); fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING)); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to XSDHandler SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, new Grammar[]{grammar}); } return grammar; } // parseXMLSchema(XMLInputSource) : SchemaGrammar
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);