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


Java ValidateProperty类代码示例

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


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

示例1: ValidatorImpl

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
ValidatorImpl(SymbolTable symbolTable, XMLGrammarPool grammarPool, PropertyMap properties) {
  this.symbolTable = symbolTable;
  XMLErrorHandler errorHandlerWrapper = new ErrorHandlerWrapper(properties.get(ValidateProperty.ERROR_HANDLER));
  components = new XMLComponent[] { errorReporter, schemaValidator, entityManager };
  for (int i = 0; i < components.length; i++) {
    addRecognizedFeatures(components[i].getRecognizedFeatures());
    addRecognizedProperties(components[i].getRecognizedProperties());
  }
  addRecognizedFeatures(recognizedFeatures);
  addRecognizedProperties(recognizedProperties);
  setFeature(Features.SCHEMA_AUGMENT_PSVI, false);
  setFeature(Features.SCHEMA_FULL_CHECKING, true);
  setFeature(Features.VALIDATION, true);
  setFeature(Features.SCHEMA_VALIDATION, true);
  setFeature(Features.ID_IDREF_CHECKING, true);
  setFeature(Features.IDC_CHECKING, true);
  setProperty(Properties.XMLGRAMMAR_POOL, grammarPool);
  setProperty(Properties.SYMBOL_TABLE, symbolTable);
  errorReporter.setDocumentLocator(this);
  setProperty(Properties.ERROR_REPORTER, errorReporter);
  setProperty(Properties.ERROR_HANDLER, errorHandlerWrapper);
  setProperty(Properties.VALIDATION_MANAGER, validationManager);
  setProperty(Properties.ENTITY_MANAGER, entityManager);
  setProperty(Properties.ENTITY_RESOLVER, this);
  reset();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:27,代码来源:ValidatorImpl.java

示例2: createSchema

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public Schema createSchema(SAXSource source, PropertyMap properties)
        throws IOException, SAXException, IncorrectSchemaException {
  SchemaPatternBuilder spb = new SchemaPatternBuilder();
  SAXResolver resolver = ResolverFactory.createResolver(properties);
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  DatatypeLibraryFactory dlf = properties.get(RngProperty.DATATYPE_LIBRARY_FACTORY);
  if (dlf == null)
    dlf = new DatatypeLibraryLoader();
  try {
    Pattern start = SchemaBuilderImpl.parse(createParseable(source, resolver, eh, properties), eh, dlf, spb,
                                            properties.contains(WrapProperty.ATTRIBUTE_OWNER));
    return wrapPattern(start, spb, properties);
  }
  catch (IllegalSchemaException e) {
    throw new IncorrectSchemaException();
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:18,代码来源:SchemaReaderImpl.java

示例3: wrapPattern

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
static Schema wrapPattern(Pattern start, SchemaPatternBuilder spb, PropertyMap properties) throws SAXException, IncorrectSchemaException {
  if (properties.contains(RngProperty.FEASIBLE))
    start = FeasibleTransform.transform(spb, start);
  properties = new SimplifiedSchemaPropertyMap(AbstractSchema.filterProperties(properties, supportedPropertyIds),
                                               start);
  Schema schema = new PatternSchema(spb, start, properties);
  if (spb.hasIdTypes() && properties.contains(RngProperty.CHECK_ID_IDREF)) {
    ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
    IdTypeMap idTypeMap = new IdTypeMapBuilder(eh, start).getIdTypeMap();
    if (idTypeMap == null)
      throw new IncorrectSchemaException();
    Schema idSchema;
    if (properties.contains(RngProperty.FEASIBLE))
      idSchema = new FeasibleIdTypeMapSchema(idTypeMap, properties);
    else
      idSchema = new IdTypeMapSchema(idTypeMap, properties);
    schema = new CombineSchema(schema, idSchema, properties);
  }
  return schema;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:21,代码来源:SchemaReaderImpl.java

示例4: ValidatingContentHandler

import com.thaiopensource.validate.ValidateProperty; //导入依赖的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

示例5: createValidator

import com.thaiopensource.validate.ValidateProperty; //导入依赖的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

示例6: addValidator

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public void addValidator(XMLValidator xv)
{
  PropertyMapBuilder propertyMapBuilder = new PropertyMapBuilder();
  propertyMapBuilder.put(ValidateProperty.ERROR_HANDLER, this);
  Validator validator = xv.schema.createValidator(propertyMapBuilder.toPropertyMap());
  ContentHandler contentHandler = validator.getContentHandler();
  if (contentHandler != null)
  {
    validatorContentHandlers.add(contentHandler);
  }
  DTDHandler dtdHandler = validator.getDTDHandler();
  if (dtdHandler != null)
  {
    validatorDTDHandlers.add(dtdHandler);
  }
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:17,代码来源:XMLParser.java

示例7: createSchematronDriver

import com.thaiopensource.validate.ValidateProperty; //导入依赖的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

示例8: process

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public void process(Exchange exchange) throws Exception {
    Jaxp11XMLReaderCreator xmlCreator = new Jaxp11XMLReaderCreator();
    DefaultValidationErrorHandler errorHandler = new DefaultValidationErrorHandler();

    PropertyMapBuilder mapBuilder = new PropertyMapBuilder();
    mapBuilder.put(ValidateProperty.XML_READER_CREATOR, xmlCreator);
    mapBuilder.put(ValidateProperty.ERROR_HANDLER, errorHandler);
    PropertyMap propertyMap = mapBuilder.toPropertyMap();

    Validator validator = getSchema().createValidator(propertyMap);

    Message in = exchange.getIn();
    SAXSource saxSource = in.getBody(SAXSource.class);
    if (saxSource == null) {
        Source source = exchange.getIn().getMandatoryBody(Source.class);
        saxSource = ExchangeHelper.convertToMandatoryType(exchange, SAXSource.class, source);
    }
    InputSource bodyInput = saxSource.getInputSource();

    // now lets parse the body using the validator
    XMLReader reader = xmlCreator.createXMLReader();
    reader.setContentHandler(validator.getContentHandler());
    reader.setDTDHandler(validator.getDTDHandler());
    reader.setErrorHandler(errorHandler);
    reader.parse(bodyInput);

    errorHandler.handleErrors(exchange, schema);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:29,代码来源:JingValidator.java

示例9: ValidatorImpl

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
ValidatorImpl(Templates templates, SAXTransformerFactory factory, PropertyMap properties) {
  this.templates = templates;
  this.factory = factory;
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  outputHandler = new OutputHandler(eh);
  resolver = ResolverFactory.createResolver(properties).getResolver();
  initTransformerHandler();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:9,代码来源:ValidatorImpl.java

示例10: createSchema

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public Schema createSchema(SAXSource source, PropertyMap properties)
        throws IOException, SAXException, IncorrectSchemaException {
  SymbolTable symbolTable = new SymbolTable();
  XMLGrammarPreparser preparser = new XMLGrammarPreparser(symbolTable);
  XMLGrammarPool grammarPool = new XMLGrammarPoolImpl();
  preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
  preparser.setGrammarPool(grammarPool);
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  SAXXMLErrorHandler xeh = new SAXXMLErrorHandler(eh);
  preparser.setErrorHandler(xeh);
  EntityResolver er = properties.get(ValidateProperty.ENTITY_RESOLVER);
  if (er != null)
    preparser.setEntityResolver(new EntityResolverWrapper(er));
  try {
    preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, toXMLInputSource(source.getInputSource()));
    Name attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
    if (attributeOwner != null) {
      Reader r = new StringReader(createWrapper(attributeOwner));
 	preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,
                                new XMLInputSource(null, null, null, r, null));
    }
  }
  catch (XNIException e) {
    throw ValidatorImpl.toSAXException(e);
  }
  if (xeh.getHadError())
    throw new IncorrectSchemaException();
  return new SchemaImpl(new SynchronizedSymbolTable(symbolTable),
                        new CachingParserPool.SynchronizedGrammarPool(grammarPool),
                        properties,
                        supportedPropertyIds);
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:33,代码来源:SchemaReaderImpl.java

示例11: createSchemaReceiver

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public SchemaReceiver createSchemaReceiver(String namespaceUri,
                                           PropertyMap properties) {
  // XXX allow namespaces with incorrect version
  if (!WellKnownNamespaces.RELAX_NG.equals(namespaceUri))
    return null;
  SAXResolver resolver = ResolverFactory.createResolver(properties);
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  return new SchemaReceiverImpl(new SAXParseReceiver(resolver, eh), properties);
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:10,代码来源:SAXSchemaReceiverFactory.java

示例12: createValidator

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public Validator createValidator(PropertyMap properties) {
  ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
  return new IdValidator(idTypeMap, eh) {
    public void endDocument() {
       setComplete();
    }
  };
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:9,代码来源:FeasibleIdTypeMapSchema.java

示例13: ValidatorImpl

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
/**
 * Creates a NVDL validator. The initial mode is specified by the mode parameter.
 * Initializes the current section.
 * @param mode The start mode.
 * param triggers The triggers specified by the NVDL script.
 * @param properties Validation properties.
 */
ValidatorImpl(Mode mode, List triggers, PropertyMap properties) {
  this.properties = properties;
  this.triggers = triggers;
  this.eh = properties.get(ValidateProperty.ERROR_HANDLER);
  this.startMode = mode;
  this.elementsLocalNameStack = new Stack();
  initCurrentSection();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:16,代码来源:ValidatorImpl.java

示例14: Handler

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
/**
 * Creates a handler.
 * @param sr The Schema Receiver implementation for NVDL schemas.
 */
Handler(SchemaReceiverImpl sr) {
  this.sr = sr;
  this.eh = sr.getProperties().get(ValidateProperty.ERROR_HANDLER);
  this.ceh = new CountingErrorHandler(this.eh);
  this.resolver = ResolverFactory.createResolver(sr.getProperties());
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:11,代码来源:SchemaImpl.java

示例15: VerifierValidator

import com.thaiopensource.validate.ValidateProperty; //导入依赖的package包/类
public VerifierValidator(Verifier verifier, PropertyMap properties) {
  this.verifier = verifier;
  verifier.setErrorHandler(properties.get(ValidateProperty.ERROR_HANDLER));
  EntityResolver er = properties.get(ValidateProperty.ENTITY_RESOLVER);
  if (er != null)
    verifier.setEntityResolver(er);
  try {
    handler = verifier.getVerifierHandler();
  }
  catch (SAXException e) {
    handler = new ExceptionReportHandler(e);
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:14,代码来源:VerifierValidator.java


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