本文整理汇总了Java中org.apache.xerces.xni.parser.XMLEntityResolver类的典型用法代码示例。如果您正苦于以下问题:Java XMLEntityResolver类的具体用法?Java XMLEntityResolver怎么用?Java XMLEntityResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLEntityResolver类属于org.apache.xerces.xni.parser包,在下文中一共展示了XMLEntityResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadModel
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
public void loadModel(ModelDesc model, Collection<File> schemas, XMLEntityResolver resolver) throws Exception {
this.model = model;
for (File dtdFile : schemas) {
String fileName = dtdFile.getPath();
if (dtdFile.isDirectory() || !fileName.endsWith(".dtd") || fileName.endsWith("datatypes.dtd")) {
Util.log("skipping " + fileName);
continue;
}
Util.log("loading " + fileName + "");
String ns = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
//loadDTDByXerces(ns, dtdFile, resolver);
loadDTDByWutka(ns, dtdFile);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:DTDModelLoader.java
示例2: loadModel
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
public void loadModel(ModelDesc model, Collection<File> schemas, XMLEntityResolver resolver) throws Exception {
this.model = model;
for (File dtdFile : schemas) {
String fileName = dtdFile.getPath();
if (dtdFile.isDirectory() || !fileName.endsWith(".dtd") || fileName.endsWith("datatypes.dtd")) {
Util.log("skipping " + fileName);
continue;
}
Util.log("loading " + fileName+"..");
String ns = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
//loadDTDByXerces(ns, dtdFile, resolver);
loadDTDByWutka(ns, dtdFile);
}
}
示例3: getEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/**
* Return the current entity resolver.
*
* @return The current entity resolver, or null if none
* has been registered.
* @see #setEntityResolver
*/
public EntityResolver getEntityResolver() {
EntityResolver entityResolver = null;
try {
XMLEntityResolver xmlEntityResolver =
(XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER);
if (xmlEntityResolver != null) {
if (xmlEntityResolver instanceof EntityResolverWrapper) {
entityResolver =
((EntityResolverWrapper) xmlEntityResolver).getEntityResolver();
}
else if (xmlEntityResolver instanceof EntityResolver2Wrapper) {
entityResolver =
((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver();
}
}
}
catch (XMLConfigurationException e) {
// do nothing
}
return entityResolver;
}
示例4: parseDTD
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
DTDGrammar parseDTD(XMLInputSource is)
throws IOException {
XMLEntityResolver resolver = getEntityResolver();
if(resolver != null) {
fDTDLoader.setEntityResolver(resolver);
}
fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter);
// Should check whether the grammar with this namespace is already in
// the grammar resolver. But since we don't know the target namespace
// of the document here, we leave such check to the application...
DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is);
// by default, hand it off to the grammar pool
if (grammar != null) {
fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD,
new Grammar[]{grammar});
}
return grammar;
}
示例5: setEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/**
* Sets the resolver used to resolve external entities. The EntityResolver
* interface supports resolution of public and system identifiers.
*
* @param resolver The new entity resolver. Passing a null value will
* uninstall the currently installed resolver.
*/
public void setEntityResolver(EntityResolver resolver) {
try {
XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER);
if (fUseEntityResolver2 && resolver instanceof EntityResolver2) {
if (xer instanceof EntityResolver2Wrapper) {
EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer;
er2w.setEntityResolver((EntityResolver2) resolver);
}
else {
fConfiguration.setProperty(ENTITY_RESOLVER,
new EntityResolver2Wrapper((EntityResolver2) resolver));
}
}
else {
if (xer instanceof EntityResolverWrapper) {
EntityResolverWrapper erw = (EntityResolverWrapper) xer;
erw.setEntityResolver(resolver);
}
else {
fConfiguration.setProperty(ENTITY_RESOLVER,
new EntityResolverWrapper(resolver));
}
}
}
catch (XMLConfigurationException e) {
// do nothing
}
}
示例6: setEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/**
* Sets the entity resolver.
*
* @param entityResolver The new entity resolver.
*/
public void setEntityResolver(XMLEntityResolver entityResolver) {
if (fEntityResolver != entityResolver) {
// Overflow. We actually need to reset the
// modCount on every XMLGrammarLoaderContainer.
if (++fModCount < 0) {
clearModCounts();
}
fEntityResolver = entityResolver;
}
}
示例7: parseXMLSchema
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
SchemaGrammar parseXMLSchema(XMLInputSource is)
throws IOException {
XMLEntityResolver resolver = getEntityResolver();
if(resolver != null) {
fSchemaLoader.setEntityResolver(resolver);
}
if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
}
fSchemaLoader.setProperty(ERROR_REPORTER, fErrorReporter);
String propPrefix = Constants.XERCES_PROPERTY_PREFIX;
String propName = propPrefix + Constants.SCHEMA_LOCATION;
fSchemaLoader.setProperty(propName, getProperty(propName));
propName = propPrefix + Constants.SCHEMA_NONS_LOCATION;
fSchemaLoader.setProperty(propName, getProperty(propName));
propName = Constants.JAXP_PROPERTY_PREFIX+Constants.SCHEMA_SOURCE;
fSchemaLoader.setProperty(propName, getProperty(propName));
fSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, getFeature(SCHEMA_FULL_CHECKING));
// Should check whether the grammar with this namespace is already in
// the grammar resolver. But since we don't know the target namespace
// of the document here, we leave such check to XSDHandler
SchemaGrammar grammar = (SchemaGrammar)fSchemaLoader.loadGrammar(is);
// by default, hand it off to the grammar pool
if (grammar != null) {
fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,
new Grammar[]{grammar});
}
return grammar;
}
示例8: reset
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException {
// obtain references from the manager
fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
try {
fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
}
catch (XMLConfigurationException e) {
fEntityResolver = null;
}
}
示例9: setProperty
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/**
* Sets the value of a property. This method is called by the component
* manager any time after reset when a property changes value.
* <p>
* <strong>Note:</strong> Components should silently ignore properties
* that do not affect the operation of the component.
*
* @param propertyId The property identifier.
* @param value The value of the property.
*
* @throws SAXNotRecognizedException The component should not throw
* this exception.
* @throws SAXNotSupportedException The component should not throw
* this exception.
*/
public void setProperty(String propertyId, Object value)
throws XMLConfigurationException {
if (propertyId.equals(SYMBOL_TABLE)) {
fSymbolTable = (SymbolTable)value;
fDTDScanner.setProperty(propertyId, value);
fEntityManager.setProperty(propertyId, value);
}
else if(propertyId.equals(ERROR_REPORTER)) {
fErrorReporter = (XMLErrorReporter)value;
// Add XML message formatter if there isn't one.
if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
}
fDTDScanner.setProperty(propertyId, value);
fEntityManager.setProperty(propertyId, value);
}
else if (propertyId.equals(ERROR_HANDLER)) {
fErrorReporter.setProperty(propertyId, value);
}
else if (propertyId.equals(ENTITY_RESOLVER)) {
fEntityResolver = (XMLEntityResolver)value;
fEntityManager.setProperty(propertyId, value);
}
else if (propertyId.equals(LOCALE)) {
setLocale((Locale) value);
}
else if(propertyId.equals(GRAMMAR_POOL)) {
fGrammarPool = (XMLGrammarPool)value;
}
else {
throw new XMLConfigurationException(XMLConfigurationException.NOT_RECOGNIZED, propertyId);
}
}
示例10: resolveDocument
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/**
* This method tries to resolve location of the given schema.
* The loader stores the namespace/location pairs in a hashtable (use "" as the
* namespace of absent namespace). When resolving an entity, loader first tries
* to find in the hashtable whether there is a value for that namespace,
* if so, pass that location value to the user-defined entity resolver.
*
* @param desc
* @param locationPairs
* @param entityResolver
* @return the XMLInputSource
* @throws IOException
*/
public static XMLInputSource resolveDocument(XSDDescription desc, Hashtable locationPairs,
XMLEntityResolver entityResolver) throws IOException {
String loc = null;
// we consider the schema location properties for import
if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT ||
desc.fromInstance()) {
// use empty string as the key for absent namespace
String namespace = desc.getTargetNamespace();
String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace;
// get the location hint for that namespace
LocationArray tempLA = (LocationArray)locationPairs.get(ns);
if(tempLA != null)
loc = tempLA.getFirstLocation();
}
// if it's not import, or if the target namespace is not set
// in the schema location properties, use location hint
if (loc == null) {
String[] hints = desc.getLocationHints();
if (hints != null && hints.length > 0)
loc = hints[0];
}
String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false);
desc.setLiteralSystemId(loc);
desc.setExpandedSystemId(expandedLoc);
return entityResolver.resolveEntity(desc);
}
示例11: loadModel
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
public void loadModel(ModelDesc model, Collection<File> files, XMLEntityResolver resolver) throws Exception {
this.model = model;
processSchemas(files, resolver);
}
示例12: loadModel
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
public void loadModel(ModelDesc model, Collection<File> files, XMLEntityResolver resolver) throws Exception {
this.model = model;
processSchemas(files, resolver);
}
示例13: getXsdEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
protected XMLEntityResolver getXsdEntityResolver() {
return new TestXSDResolver();
}
示例14: getEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/** Returns the registered entity resolver. */
public XMLEntityResolver getEntityResolver();
示例15: getEntityResolver
import org.apache.xerces.xni.parser.XMLEntityResolver; //导入依赖的package包/类
/** Returns the registered entity resolver. */
public XMLEntityResolver getEntityResolver() {
return fEntityResolver;
}