Search in sources :

Example 6 with XMLSchemaFactory

use of org.apache.xerces.jaxp.validation.XMLSchemaFactory in project webtools.sourceediting by eclipse.

the class UserDefinedSITest method loadSchema.

private Schema loadSchema() throws SAXException {
    String schemaFile = "/TestSources/userdefined.xsd";
    SchemaFactory schemaFactory = new XMLSchemaFactory();
    URL schemaURL = bundle.getEntry(schemaFile);
    Schema jaxpschema = schemaFactory.newSchema(schemaURL);
    return jaxpschema;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) Schema(javax.xml.validation.Schema) URL(java.net.URL)

Example 7 with XMLSchemaFactory

use of org.apache.xerces.jaxp.validation.XMLSchemaFactory in project webtools.sourceediting by eclipse.

the class KindTestSITest method loadSchema.

private Schema loadSchema() throws SAXException {
    String schemaFile = "/TestSources/SpecialTypes.xsd";
    SchemaFactory schemaFactory = new XMLSchemaFactory();
    URL schemaURL = bundle.getEntry(schemaFile);
    Schema jaxpschema = schemaFactory.newSchema(schemaURL);
    return jaxpschema;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) Schema(javax.xml.validation.Schema) URL(java.net.URL)

Example 8 with XMLSchemaFactory

use of org.apache.xerces.jaxp.validation.XMLSchemaFactory in project webtools.sourceediting by eclipse.

the class NotationEQSITest method loadSchema.

private Schema loadSchema() throws SAXException {
    String schemaFile = "/TestSources/notationschema.xsd";
    SchemaFactory schemaFactory = new XMLSchemaFactory();
    URL schemaURL = bundle.getEntry(schemaFile);
    Schema jaxpschema = schemaFactory.newSchema(schemaURL);
    return jaxpschema;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) Schema(javax.xml.validation.Schema) URL(java.net.URL)

Example 9 with XMLSchemaFactory

use of org.apache.xerces.jaxp.validation.XMLSchemaFactory in project iaf by ibissource.

the class MyErrorHandler method getValidatorHandler.

@Override
public ValidatorHandler getValidatorHandler(PipeLineSession session, ValidationContext context) throws ConfigurationException {
    ValidatorHandler validatorHandler;
    try {
        javax.xml.validation.Schema schemaObject;
        if (isXmlSchema1_0()) {
            XMLSchemaFactory schemaFactory = new XMLSchemaFactory();
            schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool());
        } else {
            XMLSchema11Factory schemaFactory = new XMLSchema11Factory();
            schemaObject = schemaFactory.newSchema(((XercesValidationContext) context).getGrammarPool());
        }
        validatorHandler = schemaObject.newValidatorHandler();
    } catch (SAXException e) {
        throw new ConfigurationException(logPrefix + "Cannot create schema", e);
    }
    try {
        // validatorHandler.setFeature(NAMESPACES_FEATURE_ID, true);
        validatorHandler.setFeature(VALIDATION_FEATURE_ID, true);
        validatorHandler.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
        validatorHandler.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, isFullSchemaChecking());
        validatorHandler.setFeature(DISSALLOW_DOCTYPE_DECL_FEATURE_ID, true);
        SecurityManager securityManager = new SecurityManager();
        securityManager.setEntityExpansionLimit(entityExpansionLimit);
        validatorHandler.setProperty(SECURITY_MANAGER_PROPERTY_ID, securityManager);
        validatorHandler.setContentHandler(context.getContentHandler());
        validatorHandler.setErrorHandler(context.getErrorHandler());
    } catch (SAXNotRecognizedException e) {
        throw new ConfigurationException(logPrefix + "ValidatorHandler does not recognize necessary feature", e);
    } catch (SAXNotSupportedException e) {
        throw new ConfigurationException(logPrefix + "ValidatorHandler does not support necessary feature", e);
    }
    return validatorHandler;
}
Also used : SAXNotSupportedException(org.xml.sax.SAXNotSupportedException) ValidatorHandler(javax.xml.validation.ValidatorHandler) SecurityManager(org.apache.xerces.util.SecurityManager) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) XMLSchemaFactory(org.apache.xerces.jaxp.validation.XMLSchemaFactory) SAXNotRecognizedException(org.xml.sax.SAXNotRecognizedException) XMLSchema11Factory(org.apache.xerces.jaxp.validation.XMLSchema11Factory) SAXException(org.xml.sax.SAXException)

Aggregations

XMLSchemaFactory (org.apache.xerces.jaxp.validation.XMLSchemaFactory)9 Schema (javax.xml.validation.Schema)8 SchemaFactory (javax.xml.validation.SchemaFactory)8 URL (java.net.URL)7 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DOMSource (javax.xml.transform.dom.DOMSource)1 Validator (javax.xml.validation.Validator)1 ValidatorHandler (javax.xml.validation.ValidatorHandler)1 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)1 XMLSchema11Factory (org.apache.xerces.jaxp.validation.XMLSchema11Factory)1 SecurityManager (org.apache.xerces.util.SecurityManager)1 SAXException (org.xml.sax.SAXException)1 SAXNotRecognizedException (org.xml.sax.SAXNotRecognizedException)1 SAXNotSupportedException (org.xml.sax.SAXNotSupportedException)1