/** * Creates a selector with a default {@link XmlValidator}. The validator will be initialized with * the provided 'schema' location {@link Resource} and 'schemaType'. The valid options for schema * type are {@link XmlValidatorFactory#SCHEMA_W3C_XML} or {@link XmlValidatorFactory#SCHEMA_RELAX_NG}. * If no 'schemaType' is provided it will default to {@link XmlValidatorFactory#SCHEMA_W3C_XML}; * @param schema The schema. * @param schemaType The schema type. * @throws IOException if the XmlValidatorFactory fails to create a validator */ public XmlValidatingMessageSelector(Resource schema, SchemaType schemaType) throws IOException { this(XmlValidatorFactory.createValidator(schema, schemaType == null ? SchemaType.XML_SCHEMA.getUrl() : schemaType.getUrl())); }
public XmlValidator createValidator() throws IOException { return XmlValidatorFactory.createValidator(xsdResource, XmlValidatorFactory.SCHEMA_W3C_XML); }
/** * Create a {@link XmlValidator} with the given schema resource and schema language type. The schema language must * be one of the {@code SCHEMA_XXX} constants. * * @param schemaResource a resource that locates the schema to validate against * @param schemaLanguage the language of the schema * @return a validator * @throws IOException if the schema resource cannot be read * @throws IllegalArgumentException if the schema language is not supported * @throws IllegalStateException if JAXP 1.0 cannot be located * @throws XmlValidationException if a {@code XmlValidator} cannot be created * @see #SCHEMA_RELAX_NG * @see #SCHEMA_W3C_XML */ public static XmlValidator createValidator(Resource schemaResource, String schemaLanguage) throws IOException { return createValidator(new Resource[]{schemaResource}, schemaLanguage); }
/** * Create a {@link XmlValidator} with the given schema resource and schema language type. The schema language must * be one of the <code>SCHEMA_XXX</code> constants. * * @param schemaResource a resource that locates the schema to validate against * @param schemaLanguage the language of the schema * @return a validator * @throws IOException if the schema resource cannot be read * @throws IllegalArgumentException if the schema language is not supported * @throws IllegalStateException if JAXP 1.0 cannot be located * @throws XmlValidationException if a <code>XmlValidator</code> cannot be created * @see #SCHEMA_RELAX_NG * @see #SCHEMA_W3C_XML */ public static XmlValidator createValidator(Resource schemaResource, String schemaLanguage) throws IOException { return createValidator(new Resource[]{schemaResource}, schemaLanguage); }
/** * Create a {@link XmlValidator} with the given schema resource and schema language type. The schema language must * be one of the {@code SCHEMA_XXX} constants. * * @param schemaResource a resource that locates the schema to validate against * @param schemaLanguage the language of the schema * @return a validator * @throws IOException if the schema resource cannot be read * @throws IllegalArgumentException if the schema language is not supported * @throws IllegalStateException if JAXP 1.0 cannot be located * @throws XmlValidationException if a {@code XmlValidator} cannot be created * @see #SCHEMA_RELAX_NG * @see #SCHEMA_W3C_XML */ public static XmlValidator createValidator(Resource schemaResource, String schemaLanguage) throws IOException { return createValidator(new Resource[]{schemaResource}, schemaLanguage); }
/** * Creates a {@code SchemaValidatingMatcher} based on the given schema resource(s). * * @param schema the schema * @param furtherSchemas further schemas, if necessary * @throws IOException in case of I/O errors */ public SchemaValidatingMatcher(Resource schema, Resource... furtherSchemas) throws IOException { Assert.notNull(schema, "'schema' must not be null"); Resource[] joinedSchemas = new Resource[furtherSchemas.length + 1]; joinedSchemas[0] = schema; System.arraycopy(furtherSchemas, 0, joinedSchemas, 1, furtherSchemas.length); xmlValidator = XmlValidatorFactory.createValidator(joinedSchemas, XmlValidatorFactory.SCHEMA_W3C_XML); }
/** * Creates a {@code SchemaValidatingMatcher} based on the given schema resource(s). * * @param schema the schema * @param furtherSchemas further schemas, if necessary * @throws IOException in case of I/O errors */ public SchemaValidatingMatcher(Resource schema, Resource... furtherSchemas) throws IOException { Assert.notNull(schema, "'schema' must not be null"); Resource[] joinedSchemas = new Resource[furtherSchemas.length + 1]; joinedSchemas[0] = schema; System.arraycopy(furtherSchemas, 0, joinedSchemas, 1, furtherSchemas.length); xmlValidator = XmlValidatorFactory.createValidator(joinedSchemas, XmlValidatorFactory.SCHEMA_W3C_XML); }
/** * Creates a {@code SchemaValidatingMatcher} based on the given schema resource(s). * * @param schema the schema * @param furtherSchemas further schemas, if necessary * @throws IOException in case of I/O errors */ public SchemaValidatingMatcher(Resource schema, Resource... furtherSchemas) throws IOException { Assert.notNull(schema, "'schema' must not be null"); Resource[] joinedSchemas = new Resource[furtherSchemas.length + 1]; joinedSchemas[0] = schema; System.arraycopy(furtherSchemas, 0, joinedSchemas, 1, furtherSchemas.length); xmlValidator = XmlValidatorFactory.createValidator(joinedSchemas, XmlValidatorFactory.SCHEMA_W3C_XML); }
@Override public XmlValidator createValidator() { try { return XmlValidatorFactory.createValidator(schemaResources.toArray(new Resource[schemaResources.size()]), W3C_XML_SCHEMA_NS_URI); } catch (IOException e) { throw new CitrusRuntimeException("Failed to create validator from multi resource schema files", e); } }
@Override public XmlValidator createValidator() { try { return XmlValidatorFactory.createValidator(xsdResource, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new XsdSchemaException(ex.getMessage(), ex); } }
@Override public XmlValidator createValidator() { try { return XmlValidatorFactory.createValidator(xsdResource, XmlValidatorFactory.SCHEMA_W3C_XML); } catch (IOException ex) { throw new XsdSchemaException(ex.getMessage(), ex); } }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
@Override public void afterPropertiesSet() throws Exception { if (validator == null && !ObjectUtils.isEmpty(schemas)) { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (Resource schema : schemas) { Assert.isTrue(schema.exists(), "schema [" + schema + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using " + StringUtils.arrayToCommaDelimitedString(schemas)); } validator = XmlValidatorFactory.createValidator(schemas, schemaLanguage); } Assert.notNull(validator, "Setting 'schema', 'schemas', 'xsdSchema', or 'xsdSchemaCollection' is required"); }
public XmlValidator createValidator() throws IOException { Resource[] resources = new Resource[xmlSchemas.size()]; for (int i = xmlSchemas.size() - 1; i >= 0; i--) { XmlSchema xmlSchema = xmlSchemas.get(i); resources[i] = new UrlResource(xmlSchema.getSourceURI()); } return XmlValidatorFactory.createValidator(resources, XmlValidatorFactory.SCHEMA_W3C_XML); }