当前位置: 首页>>代码示例>>Java>>正文


Java ValidationDriver类代码示例

本文整理汇总了Java中com.thaiopensource.validate.ValidationDriver的典型用法代码示例。如果您正苦于以下问题:Java ValidationDriver类的具体用法?Java ValidationDriver怎么用?Java ValidationDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ValidationDriver类属于com.thaiopensource.validate包,在下文中一共展示了ValidationDriver类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doWork

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
/**
 * This class checks OCL violation, exports the file, and validates it.
 * 
 * @param pndoc
 *            the pnml document object.
 * @param schemafile
 *            the schemat file url.
 * @throws OCLValidationFailed
 *             if an ocl violation is detected.
 * @throws IOException
 *             if a problem occur with file access.
 * @throws ValidationFailedException
 *             if the pnml validation fail.
 */
private void doWork(HLAPIClass pndoc, String schemafile)
		throws OCLValidationFailed, IOException, ValidationFailedException {

	oclChecking(pndoc);
	log.trace("OCL ok, writting temporary file");

	// Original code: final String output = pndoc.toPNML();
	/*
	 * final Writer writefile = new BufferedWriter(new FileWriter(out));
	 * writefile.write(output); writefile.close();
	 */
	// Experimental code: writeToFileNIOWay(out, output);
	final FileOutputStream fos = new FileOutputStream(out);
	final FileChannel fc = fos.getChannel();
	pndoc.toPNML(fc);

	log.trace(WRITING_TO_PNML_FILE_OK);
	fc.close();
	fos.close();

	log.trace(VALIDATION_AGAINST_GRAMMAR);
	rngGrammarValidation(schemafile,
			ValidationDriver.uriOrFileInputSource(out.getAbsolutePath()));
}
 
开发者ID:lip6,项目名称:pnmlframework,代码行数:39,代码来源:PnmlExport.java

示例2: createSchematronDriver

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
/**
 * Sets up the schematron reader with all the necessary parameters. Calls
 * initSchematronReader() to do further setup of the validation driver.
 * 
 * @param phase
 *            The string phase name (contained in schematron file)
 * @return The ValidationDriver to use in validating the XML document
 */
ValidationDriver createSchematronDriver(String phase) {
    SchemaReaderLoader loader = new SchemaReaderLoader();
    SchemaReader schReader = loader.createSchemaReader(SCHEMATRON_NS_URI);
    this.configPropBuilder = new PropertyMapBuilder();
    SchematronProperty.DIAGNOSE.add(this.configPropBuilder);

    if (this.outputLogger == null) {
        this.outputLogger = new PrintWriter(System.out);
    }
    if (null != phase && !phase.isEmpty()) {
        this.configPropBuilder.put(SchematronProperty.PHASE, phase);
    }
    ErrorHandler eh = new ErrorHandlerImpl("Schematron", outputLogger);
    this.configPropBuilder.put(ValidateProperty.ERROR_HANDLER, eh);
    ValidationDriver validator = new ValidationDriver(
            this.configPropBuilder.toPropertyMap(), schReader);
    return validator;
}
 
开发者ID:opengeospatial,项目名称:teamengine,代码行数:27,代码来源:SchematronValidatingParser.java

示例3: loadSchema

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
private boolean loadSchema(File schema) throws IOException {
   nTests++;
   try {
     if (driver.loadSchema(ValidationDriver.fileInputSource(schema)))
return true;
   }
   catch (SAXException e) {
     eh.printException(e);
   }
   return false;
 }
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:12,代码来源:TestDriver.java

示例4: validateInstance

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
private boolean validateInstance(File instance) throws IOException {
   nTests++;
   try {
     if (driver.validate(ValidationDriver.fileInputSource(instance)))
return true;
   }
   catch (SAXException e) {
     eh.printException(e);
   }
   return false;
 }
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:12,代码来源:TestDriver.java

示例5: validate

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
public void validate(File file, String fileName) throws IOException {
    validate(ValidationDriver.fileInputSource(file), fileName);
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:4,代码来源:SchemaValidator.java

示例6: createDriver

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
/**
 * Creates and initializes a ValidationDriver to perform Schematron
 * validation. A schema must be loaded before an instance can be validated.
 * 
 * @param configProps
 *            A PropertyMap containing properties to configure schema
 *            construction and validation behavior; it typically includes
 *            {@code SchematronProperty} and {@code ValidationProperty}
 *            items.
 * @return A ValidationDriver that is ready to load a Schematron schema.
 */
ValidationDriver createDriver(PropertyMap configProps) {
    SchemaReaderLoader loader = new SchemaReaderLoader();
    SchemaReader schReader = loader.createSchemaReader(SCHEMATRON_NS_URI);
    ValidationDriver validator = new ValidationDriver(configProps,
            schReader);
    return validator;
}
 
开发者ID:opengeospatial,项目名称:teamengine,代码行数:19,代码来源:SchematronValidatingParser.java

示例7: SchemaValidator

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
/**
 * Initializes the validator by using the given file as schema file
 *
 * @param schemaFile schema file
 * @throws IOException if it is not possible to read schema files
 */
SchemaValidator(File schemaFile, DeployLogger deployLogger) throws IOException, SAXException {
    this.deployLogger = deployLogger;
    this.driver = new ValidationDriver(PropertyMap.EMPTY, instanceProperties(), CompactSchemaReader.getInstance());
    driver.loadSchema(ValidationDriver.fileInputSource(schemaFile));
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:12,代码来源:SchemaValidator.java

示例8: validatePnmlDoc

import com.thaiopensource.validate.ValidationDriver; //导入依赖的package包/类
/**
 * Checks if a given pnml file is valid with a given grammar file.
 *
 * @param schemafile
 *            the path to schema file.
 * @param pnmldoc
 *            the path to doc.
 * @return true if valid
 * @throws ValidationProcessException
 *             if an error occur while reading the grammar
 */
public final boolean validatePnmlDoc(String schemafile, String pnmldoc)
        throws ValidationProcessException {

    InputSource pnmldocStream = null;
    pnmldocStream = ValidationDriver.fileInputSource(pnmldoc);

    return validatePnmlDoc(schemafile, pnmldocStream);

}
 
开发者ID:lip6,项目名称:pnmlframework,代码行数:21,代码来源:PnmlRngValidation.java


注:本文中的com.thaiopensource.validate.ValidationDriver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。