Package javax.xml.validation

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


        try {
            InputStream inputStream = xsdResource.getInputStream();
            Source source = new StreamSource(inputStream);
   
            Schema schema = factory.newSchema(source);
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(document));
        }
        catch (SAXParseException e) {
            throw new ExecutionException("Error on " + e.getLineNumber() + ", column " + e.getColumnNumber() + " in " + description + ": " + e.getMessage(), e);
        }
View Full Code Here


        try {
            InputStream inputStream = xsdResource.getInputStream();
            Source source = new StreamSource(inputStream);
   
            schema = factory.newSchema(source);
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(document));
        }
        catch (SAXParseException e) {
            throw new ExecutionException("Error on " + e.getLineNumber() + ", column " + e.getColumnNumber() + " in " + description + ": " + e.getMessage(), e);
        }
View Full Code Here

        try {
            InputStream inputStream = xsdResource.getInputStream();
            Source source = new StreamSource(inputStream);
   
            Schema schema = factory.newSchema(source);
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(document));
        }
        catch (SAXParseException e) {
            throw new ExecutionException("Error on " + e.getLineNumber() + ", column " + e.getColumnNumber() + " in " + description + ": " + e.getMessage(), e);
        }
View Full Code Here

            String language = "http://www.w3.org/2001/XMLSchema";
            SchemaFactory factory = SchemaFactory.newInstance(language);

            Source source = new DOMSource(map.getSchema());
            Schema schema = factory.newSchema(source);
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(xml));
            //if no exceptions where raised, the document is valid
            isValid=true;

View Full Code Here

                    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

        schemas[0] = schemaFile;
       
        Schema schema = factory.newSchema(schemas);

        // create a Validator instance, which can be used to validate an instance document
        Validator validator = schema.newValidator();
       
       
        // validate the DOM tree
       
            validator.validate(new DOMSource(document));
View Full Code Here

      Schema schema = factory.newSchema(schemas);

     
     
      // create a Validator instance, which can be used to validate an instance document
      Validator validator = schema.newValidator();

     
      // validate the DOM tree
        validator.validate(new DOMSource(document));
        validator.validate(new DOMSource(document2));
View Full Code Here

          Schema schema = factory.newSchema(schemas);

         
         
          // create a Validator instance, which can be used to validate an instance document
          Validator validator = schema.newValidator();

          validator.setErrorHandler(new DefaultErrorHandler());
         
          // validate the DOM tree
          validator.validate(new DOMSource(ssafPayloadDataNode));
View Full Code Here

                        // get the value child of the property element
                        Document property = (Document)componentProperty.getValue();
                        Element value = (Element)property.getDocumentElement().getFirstChild();
               
                        // validate the element property/value from the DOM
                        Validator validator = schema.newValidator();
                        validator.validate(new DOMSource(value));
                       
                    } catch (Exception e) {
                        Monitor.error(monitor,
                                this,
View Full Code Here

    Source source = new StreamSource(schemaFile);

    // Create a Validator object, which can be used to validate
    // an instance document.
    Schema schema = factory.newSchema(source);
    Validator validator = schema.newValidator();

    // Validate the DOM tree.
    validator.validate(new DOMSource(sourceElement));
  }
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.