Examples of newValidator()


Examples of javax.xml.validation.Schema.newValidator()

                    schema = factory.newSchema(src);
                } catch (SAXException ex) {
                    LOGGER.error("Error parsing Log4j schema", ex);
                }
                if (schema != null) {
                    validator = schema.newValidator();
                    try {
                        validator.validate(new StreamSource(new ByteArrayInputStream(buffer)));
                    } catch (IOException ioe) {
                        LOGGER.error("Error reading configuration for validation", ioe);
                    } catch (SAXException ex) {
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

    private URL schemaUrl;
    private File schemaFile;

    public void process(Exchange exchange) throws Exception {
        Schema schema = getSchema();
        Validator validator = schema.newValidator();

        Source source = exchange.getIn().getBody(DOMSource.class);
        if (source == null) {
            throw new NoXmlBodyValidationException(exchange);
        }
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

                        new StreamSource(xmlSchemaURL.openStream()),
                        new StreamSource(javaeeSchemaURL.openStream())
                });

        // validate
        schema.newValidator().validate(sourceForValidate);
    }
   
    private static URL getSchemaURL(String xsdFileName){
        return JaxbJavaee.class.getClassLoader().getResource("/META-INF/schema/" + xsdFileName);
    }
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

            schema = getSchema();
        } else {
            schema = createSchema();
        }

        Validator validator = schema.newValidator();

        // the underlying input stream, which we need to close to avoid locking files or other resources
        Source source = null;
        InputStream is = null;
        try {
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

                    schema = factory.newSchema(src);
                } catch (final SAXException ex) {
                    LOGGER.error("Error parsing Log4j schema", ex);
                }
                if (schema != null) {
                    validator = schema.newValidator();
                    try {
                        validator.validate(new StreamSource(new ByteArrayInputStream(buffer)));
                    } catch (final IOException ioe) {
                        LOGGER.error("Error reading configuration for validation", ioe);
                    } catch (final SAXException ex) {
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

                    schema = factory.newSchema(src);
                } catch (final SAXException ex) {
                    LOGGER.error("Error parsing Log4j schema", ex);
                }
                if (schema != null) {
                    final Validator validator = schema.newValidator();
                    try {
                        validator.validate(new StreamSource(new ByteArrayInputStream(buffer)));
                    } catch (final IOException ioe) {
                        LOGGER.error("Error reading configuration for validation", ioe);
                    } catch (final SAXException ex) {
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

                .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Source schemaSource = new StreamSource(filexsd);

        Schema schema = factory.newSchema(schemaSource);
        // validate source xml to xsd
        Validator validator = schema.newValidator();
        validator.validate(new StreamSource(filexml));

        // parse xml to dom
        DocumentBuilder parser = DocumentBuilderFactory.newInstance()
                .newDocumentBuilder();
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

                .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Source schemaSource = new StreamSource(filexsd);

        Schema schema = factory.newSchema(schemaSource);
        // validate source xml to xsd
        Validator validator = schema.newValidator();
        validator.validate(new StreamSource(filexml));

        // parse xml to dom
        DocumentBuilder parser = DocumentBuilderFactory.newInstance()
                .newDocumentBuilder();
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

      if (schemaURL != null)
      {
         try
         {
            Schema schema = factory.newSchema(schemaURL);
            Validator validator = schema.newValidator();
            Reporter reporter = new Reporter(url);
            validator.setErrorHandler(reporter);

            // Validate the document
            validator.validate(new StreamSource(url.openStream()));
View Full Code Here

Examples of javax.xml.validation.Schema.newValidator()

    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    docBuilderFactory.setNamespaceAware( true );
    final Schema v2Schema = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI )
        .newSchema( new StreamSource( getStreamFromClasspath( "persistence_2_0.xsd" ) ) );
    final Validator v2Validator = v2Schema.newValidator();
    final Schema v1Schema = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI )
        .newSchema( new StreamSource( getStreamFromClasspath( "persistence_1_0.xsd" ) ) );
    final Validator v1Validator = v1Schema.newValidator();

    InputSource source = new InputSource( is );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.