本文整理汇总了Java中com.thaiopensource.util.PropertyMap类的典型用法代码示例。如果您正苦于以下问题:Java PropertyMap类的具体用法?Java PropertyMap怎么用?Java PropertyMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyMap类属于com.thaiopensource.util包,在下文中一共展示了PropertyMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValidatorImpl
import com.thaiopensource.util.PropertyMap; //导入依赖的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();
}
示例2: createSchema
import com.thaiopensource.util.PropertyMap; //导入依赖的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();
}
}
示例3: wrapPattern
import com.thaiopensource.util.PropertyMap; //导入依赖的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;
}
示例4: createSubSchema
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
private Schema createSubSchema(boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException {
PropertyMap requestedProperties = options.toPropertyMap();
Schema schema = sr.createChildSchema(resolver.resolve(schemaUri, schemaUriBase),
schemaType,
requestedProperties,
isAttributesSchema);
PropertyMap actualProperties = schema.getProperties();
for (Enumeration e = mustSupportOptions.elements(); e.hasMoreElements();) {
MustSupportOption mso = (MustSupportOption)e.nextElement();
Object actualValue = actualProperties.get(mso.pid);
if (actualValue == null)
error("unsupported_option", mso.name, mso.locator);
else if (!actualValue.equals(requestedProperties.get(mso.pid)))
error("unsupported_option_arg", mso.name, mso.locator);
}
return schema;
}
示例5: SchemaReceiverImpl
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
public SchemaReceiverImpl(PropertyMap properties) {
Name attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
attributesSchema = (attributeOwner != null);
PropertyMapBuilder builder = new PropertyMapBuilder(properties);
if (ValidatorImpl.OWNER_NAME.equals(attributeOwner)) {
attributeSchemaProperties = properties;
builder.put(WrapProperty.ATTRIBUTE_OWNER, null);
this.properties = builder.toPropertyMap();
}
else {
if (attributeOwner == null)
this.properties = properties;
else {
builder.put(WrapProperty.ATTRIBUTE_OWNER, null);
this.properties = builder.toPropertyMap();
}
builder.put(WrapProperty.ATTRIBUTE_OWNER, ValidatorImpl.OWNER_NAME);
attributeSchemaProperties = builder.toPropertyMap();
}
this.autoSchemaLanguage = new AutoSchemaReader(properties.get(SchemaReceiverFactory.PROPERTY));
}
示例6: createSubSchema
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
/**
* Creates a sub schema for the ending validate action (this is
* called from finishValidate).
*
* @param isAttributesSchema If the schema is intended to validate only attributes.
* @return A Schema.
* @throws IOException
* @throws IncorrectSchemaException
* @throws SAXException
*/
private Schema createSubSchema(boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException {
// the user specified options
PropertyMap requestedProperties = md.options.toPropertyMap();
// let the schema receiver create a child schema
// XXX parse the media type to the resolver
Schema schema = sr.createChildSchema(resolver.resolve(md.schemaUriRef, md.schemaUriBase),
md.schemaType,
requestedProperties,
isAttributesSchema);
// get the schema properties
PropertyMap actualProperties = schema.getProperties();
// Check if the actual properties match the must support properties.
for (Enumeration e = md.mustSupportOptions.elements(); e.hasMoreElements();) {
MustSupportOption mso = (MustSupportOption)e.nextElement();
Object actualValue = actualProperties.get(mso.pid);
if (actualValue == null)
error("unsupported_option", mso.name, mso.locator);
else if (!actualValue.equals(requestedProperties.get(mso.pid)))
error("unsupported_option_arg", mso.name, mso.locator);
}
return schema;
}
示例7: createResolver
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
static public SAXResolver createResolver(PropertyMap properties) {
Resolver[] resolvers = new Resolver[4];
int i = 0;
// user-specified Resolver first
resolvers[0] = properties.get(ValidateProperty.RESOLVER);
if (resolvers[0] != null)
i++;
// EntityResolver before uriResolver
EntityResolver entityResolver = properties.get(ValidateProperty.ENTITY_RESOLVER);
URIResolver uriResolver = properties.get(ValidateProperty.URI_RESOLVER);
if (entityResolver != null)
resolvers[i++] = SAX.createResolver(entityResolver, uriResolver == null);
if (uriResolver != null)
resolvers[i++] = Transform.createResolver(uriResolver);
while (--i > 0)
resolvers[i - 1] = new SequenceResolver(resolvers[i - 1], resolvers[i]);
// XMLReaderCreator last, so it can create an EntityResolver
XMLReaderCreator xrc = properties.get(ValidateProperty.XML_READER_CREATOR);
if (xrc != null)
return new CustomSAXResolver(resolvers[0], xrc);
return new SAXResolver(resolvers[0]);
}
示例8: createParseable
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
@Override
protected com.thaiopensource.relaxng.parse.Parseable<Pattern, NameClass, Locator, VoidValue, CommentListImpl, AnnotationsImpl> createParseable(SAXSource source,
SAXResolver resolver,
ErrorHandler errorHandler,
PropertyMap properties) throws SAXException
{
Input inputSource = SAX.createInput(source.getInputSource());
if(myDescriptorFile.getFileType() == RncFileType.getInstance())
{
return new com.thaiopensource.relaxng.parse.compact.CompactParseable<>(inputSource, resolver.getResolver(), errorHandler);
}
else
{
return new com.thaiopensource.relaxng.parse.sax.SAXParseable<>(source, resolver, errorHandler);
}
}
示例9: process
import com.thaiopensource.util.PropertyMap; //导入依赖的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);
}
示例10: ValidatorImpl
import com.thaiopensource.util.PropertyMap; //导入依赖的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();
}
示例11: SchemaImpl
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
SchemaImpl(SymbolTable symbolTable,
XMLGrammarPool grammarPool,
PropertyMap properties,
PropertyId<?>[] supportedPropertyIds) {
super(properties, supportedPropertyIds);
this.symbolTable = symbolTable;
this.grammarPool = grammarPool;
}
示例12: createSchema
import com.thaiopensource.util.PropertyMap; //导入依赖的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);
}
示例13: createSchemaReceiver
import com.thaiopensource.util.PropertyMap; //导入依赖的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);
}
示例14: createValidator
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
public Validator createValidator(PropertyMap properties) {
ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
return new IdValidator(idTypeMap, eh) {
public void endDocument() {
setComplete();
}
};
}
示例15: SchemaImpl
import com.thaiopensource.util.PropertyMap; //导入依赖的package包/类
SchemaImpl(PropertyMap properties) {
super(properties);
this.attributesSchema = properties.contains(WrapProperty.ATTRIBUTE_OWNER);
makeBuiltinMode("#allow", AllowAction.class);
makeBuiltinMode("#attach", AttachAction.class);
makeBuiltinMode("#unwrap", UnwrapAction.class);
defaultBaseMode = makeBuiltinMode("#reject", RejectAction.class);
}