本文整理汇总了Java中com.thaiopensource.relaxng.SchemaFactory类的典型用法代码示例。如果您正苦于以下问题:Java SchemaFactory类的具体用法?Java SchemaFactory怎么用?Java SchemaFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SchemaFactory类属于com.thaiopensource.relaxng包,在下文中一共展示了SchemaFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValidatingContentHandler
import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
public ValidatingContentHandler(ContentHandler child, InputSource src,
boolean compact_syntax) {
this.child = child;
try {
SchemaFactory factory = new SchemaFactory();
factory.setCompactSyntax(compact_syntax);
factory.setXMLReaderCreator(new Jaxp11XMLReaderCreator());
factory.setErrorHandler(new DraconianErrorHandler());
factory.setDatatypeLibraryFactory(new DatatypeLibraryLoader());
Schema schema = factory.createSchema(src);
this.validator = schema.createValidator(
SinglePropertyMap.newInstance(ValidateProperty.ERROR_HANDLER,
factory.getErrorHandler())).getContentHandler();
} catch (Exception e) {
throw new OntopiaRuntimeException("INTERNAL ERROR", e);
}
}
示例2: createValidator
import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
protected ContentHandler createValidator() {
String rnc;
if (xtm_version == XTMVersion.XTM_1_0)
rnc = XTM_1_RNC;
else if (xtm_version == XTMVersion.XTM_2_0 ||
xtm_version == XTMVersion.XTM_2_1)
rnc = XTM_2_RNC;
else
throw new OntopiaRuntimeException("Unknown XTM version: " + xtm_version);
InputSource src = new InputSource(XTMValidatingContentHandler.class.getResourceAsStream(rnc));
try {
SchemaFactory factory = new SchemaFactory();
factory.setXMLReaderCreator(new Jaxp11XMLReaderCreator());
factory.setErrorHandler(new DraconianErrorHandler());
factory.setDatatypeLibraryFactory(new DatatypeLibraryLoader());
Schema schema = factory.createSchema(src);
PropertyMapBuilder pmb = new PropertyMapBuilder();
pmb.put(ValidateProperty.ERROR_HANDLER, new DraconianErrorHandler());
return schema.createValidator(pmb.toPropertyMap()).getContentHandler();
} catch (Exception e) {
throw new OntopiaRuntimeException("INTERNAL ERROR: " + e, e);
}
}
示例3: getSchemaFactory
import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
public SchemaFactory getSchemaFactory() {
return schemaFactory;
}
示例4: setSchemaFactory
import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
public void setSchemaFactory(SchemaFactory schemaFactory) {
this.schemaFactory = schemaFactory;
}