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


Java SchemaFactory类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:19,代码来源:ValidatingContentHandler.java

示例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);
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:25,代码来源:XTMValidatingContentHandler.java

示例3: getSchemaFactory

import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
public SchemaFactory getSchemaFactory() {
    return schemaFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:JingEndpoint.java

示例4: setSchemaFactory

import com.thaiopensource.relaxng.SchemaFactory; //导入依赖的package包/类
public void setSchemaFactory(SchemaFactory schemaFactory) {
    this.schemaFactory = schemaFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:JingEndpoint.java


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