Package javax.xml.validation

Examples of javax.xml.validation.Validator


      schema = factory.newSchema(url);
    } catch (SAXException e) {
      log.trace("Leaving validate");
      throw new RuntimeException(e);
    }
    Validator validator = schema.newValidator();
    StringReader reader = new StringReader(xml);
    Source source = new StreamSource(reader);
    SchemaValidationResult result = null;
    try {
      validator.validate(source);
      result = new SchemaValidationResult(true, "The xml is valid.");
    } catch (SAXException ex) {
      result = new SchemaValidationResult(false, ex.getMessage());
      log.debug("Validation: " + result);
      log.debug("Cause: " + result.getMessage());
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);
        }
        catch (SAXException 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);
        }
        catch (SAXException 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);
        }
        catch (SAXException 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;


        } catch(IOException e) {
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));

        } catch (ParserConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            fail();
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));
       
       
        } catch (ParserConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
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,
                                Messages.ASSEMBLY_VALIDATION,
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

    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

Related Classes of javax.xml.validation.Validator

Copyright © 2018 www.massapicom. 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.