Package com.thaiopensource.validate

Examples of com.thaiopensource.validate.ValidationDriver.validate()


        ErrorHandlerImpl eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(error)));
        ValidateProperty.ERROR_HANDLER.put(properties, eh);
        SchemaReader schemaReader = new AutoSchemaReader();
        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
        if (driver.loadSchema(in)) {
            if (driver.validate(ValidationDriver.uriOrFileInputSource(xml.getAbsolutePath()))) {
                log.debug("" + error);
                return null;
            } else {
                log.error("" + error);
                return "" + error;
View Full Code Here


        final ValidationDriver validationDriver = new ValidationDriver();
        if (!validationDriver.loadSchema(new InputSource(
                XmlUtils.class.getResourceAsStream("/" + validationFileName)))) {
            throw new ApplicationException("Error during loading RNG schema");
        }
        if (!validationDriver.validate(ValidationDriver.fileInputSource(xmlFileName))) {
            throw new ApplicationException("Error during parsing project file");
        }
    }
   
    public static Document loadXmlDocumentWithValidation(final String xmlFileName,
View Full Code Here

        ErrorHandlerImpl eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(error)));
        ValidateProperty.ERROR_HANDLER.put(properties, eh);
        SchemaReader schemaReader = new AutoSchemaReader();
        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
        if (driver.loadSchema(in)) {
            if (driver.validate(ValidationDriver.uriOrFileInputSource(xml.getAbsolutePath()))) {
                System.out.println("" + error);
                return null;
            } else {
                return "" + error;
            }
View Full Code Here

                    new BufferedWriter(new OutputStreamWriter(error)));
            ValidateProperty.ERROR_HANDLER.put(properties, eh);
            SchemaReader schemaReader = new AutoSchemaReader();
            ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
            if (driver.loadSchema(schemaInputSource)) {
                if (driver.validate(xmlInputSource)) {
                    log.debug("" + error);
                    return null;
                }
              log.error("" + error);
              return "" + error;
View Full Code Here

            // Load schema
            driver.loadSchema(new InputSource(grammarUrl));

            // Validate XML instance
            driver.validate(new InputSource(stream));

        } catch(final IOException ex) {
            logger.error(ex);
            report.setThrowable(ex);
View Full Code Here

        InputSource doc = S9apiUtils.xdmToInputSource(runtime, srcdoc);

        try {
            driver.loadSchema(nvdl);

            if (!driver.validate(doc)) {
                if (assertValid) {
                    throw XProcException.stepError(53);
                }
            }
        } catch (SAXException e) {
View Full Code Here

        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), sr);
        try {
            if (driver.loadSchema(schemaInputSource)) {
                InputSource din = S9apiUtils.xdmToInputSource(runtime, doc);
                if (!driver.validate(din)) {
                    if (assertValid) {
                        throw XProcException.stepError(53);
                    }
                }
            } else {
View Full Code Here

            // Load schema
            driver.loadSchema(grammar);

            // Validate XML instance
            driver.validate(instance);
           
        } catch (final MalformedURLException ex) {
            LOG.error(ex.getMessage());
            report.setException(ex);
View Full Code Here

        ErrorHandlerImpl eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(error)));
        ValidateProperty.ERROR_HANDLER.put(properties, eh);
        SchemaReader schemaReader = new AutoSchemaReader();
        ValidationDriver driver = new ValidationDriver(properties.toPropertyMap(), schemaReader);
        if (driver.loadSchema(in)) {
            if (driver.validate(ValidationDriver.uriOrFileInputSource(xml.getAbsolutePath()))) {
                log.debug("" + error);
                return null;
            } else {
                log.error("" + error);
                return "" + error;
View Full Code Here

    InputStream schemaIn = schema.openStream();
    try {
      InputSource schemaSource = new InputSource(schema.openStream());
      schemaSource.setSystemId(schema.toString());
      driver.loadSchema(schemaSource);
      return driver.validate(in);
    } catch (SAXException e) {
      System.out.println(e);
      return false;
    } finally {
      schemaIn.close();
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.