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); } } }
/** Setup for validation. **/ final void setup(Location location, StAXResult result, boolean stringsInternalized) { fDepth = 0; fComponentManager.reset(); setupStAXResultHandler(result); fValidationManager.setEntityState(this); if (fEntities != null && !fEntities.isEmpty()) { // should only clear this if the last document contained unparsed entities fEntities.clear(); } fStAXLocationWrapper.setLocation(location); fErrorReporter.setDocumentLocator(fStAXLocationWrapper); fStringsInternalized = stringsInternalized; }
protected void reset() { super.reset(); fDTDScanner.reset(); fEntityManager.reset(); fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); }
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addCommonComponent(fErrorReporter);
public void startDocument() throws SAXException { fComponentManager.reset(); fSchemaValidator.setDocumentHandler(this); fValidationManager.setEntityState(this); fTypeInfoProvider.finishStartElement(); // cleans up TypeInfoProvider fNeedPushNSContext = true; if (fUnparsedEntities != null && !fUnparsedEntities.isEmpty()) { // should only clear this if the last document contained unparsed entities fUnparsedEntities.clear(); } fErrorReporter.setDocumentLocator(fSAXLocatorWrapper); try { fSchemaValidator.startDocument(fSAXLocatorWrapper, fSAXLocatorWrapper.getEncoding(), fNamespaceContext, null); } catch (XMLParseException e) { throw Util.toSAXParseException(e); } catch (XNIException e) { throw Util.toSAXException(e); } }
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addCommonComponent(fErrorReporter);
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addCommonComponent(fErrorReporter);
fXMLLocator.setLiteralSystemId(systemId); fXMLLocator.setExpandedSystemId(systemId); fErrorReporter.setDocumentLocator(fXMLLocator); try {
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addComponent(fErrorReporter);
/** * Reset the reference to the appropriate scanner given the version of the * document and start document scanning. * @param scanner - the scanner to use * @param version - the version of the document (XML 1.1 or XML 1.0). */ public void startDocumentParsing(XMLEntityHandler scanner, short version){ if (version == Constants.XML_VERSION_1_0){ fEntityManager.setScannerVersion(Constants.XML_VERSION_1_0); } else { fEntityManager.setScannerVersion(Constants.XML_VERSION_1_1); } // Make sure the locator used by the error reporter is the current entity scanner. fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); // Note: above we reset fEntityScanner in the entity manager, thus in startEntity // in each scanner fEntityScanner field must be reset to reflect the change. // fEntityManager.setEntityHandler(scanner); scanner.startEntity(fXMLSymbol, fEntityManager.getCurrentResourceIdentifier(), fEncoding, null); }
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); fProperties.put(ERROR_REPORTER, fErrorReporter); addComponent(fErrorReporter);
fErrorReporter.setDocumentLocator(locator);
ValidatorImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool, PropertyMap properties) { this.symbolTable = symbolTable; XMLErrorHandler errorHandlerWrapper = new ErrorHandlerWrapper(properties.get(ValidateProperty.ERROR_HANDLER)); components = new XMLComponent[] { errorReporter, schemaValidator }; 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); 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); // In Xerces 2.4.0, XMLSchemaValidator uses ENTITY_MANAGER when // it should use ENTITY_RESOLVER // setProperty(Properties.ENTITY_MANAGER, this); setProperty(Properties.ENTITY_RESOLVER, this); reset(); }
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(); }
fErrorReporter.setDocumentLocator(fDocLocation); fErrorReporter.setDocumentLocator(fDocLocation); fErrorReporter.setDocumentLocator(fDocLocation);
fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner()); setProperty(ERROR_REPORTER, fErrorReporter); addComponent(fErrorReporter);