本文整理汇总了Java中org.apache.xml.resolver.tools.CatalogResolver类的典型用法代码示例。如果您正苦于以下问题:Java CatalogResolver类的具体用法?Java CatalogResolver怎么用?Java CatalogResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CatalogResolver类属于org.apache.xml.resolver.tools包,在下文中一共展示了CatalogResolver类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRouteBuilder
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
// we have to do it here, because we need the context created first
CatalogManager.getStaticManager().setIgnoreMissingProperties(true);
CatalogResolver catalogResolver = new CatalogResolver(true);
URL catalogUrl = ResourceHelper.resolveMandatoryResourceAsUrl(context.getClassResolver(), "org/apache/camel/component/validator/catalog.cat");
catalogResolver.getCatalog().parseCatalog(catalogUrl);
LSResourceResolver resourceResolver = new CatalogLSResourceResolver(catalogResolver);
JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
registry.bind("resourceResolver", resourceResolver);
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.doTry()
.to("validator:org/apache/camel/component/validator/report.xsd?resourceResolver=#resourceResolver")
.to("mock:valid")
.doCatch(ValidationException.class)
.to("mock:invalid")
.doFinally()
.to("mock:finally")
.end();
}
};
}
示例2: setUpEngine
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
/**
* Setup the xpath engine, and build the document builder (which is used for parasing files into Documents)
* @throws Exception
*/
@BeforeClass
public static void setUpEngine() throws Exception {
XMLUnit.setControlParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
XMLUnit.setTestParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
XMLUnit.setSAXParserFactory("org.apache.xerces.jaxp.SAXParserFactoryImpl");
XMLUnit.setTransformerFactory("org.apache.xalan.processor.TransformerFactoryImpl");
XMLUnit.setControlEntityResolver(new CatalogResolver());
engine = XMLUnit.newXpathEngine();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
dbf.setNamespaceAware(true);
dbf.setIgnoringComments(false);
dbf.setIgnoringElementContentWhitespace(false);
dbf.setExpandEntityReferences(false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
builder = dbf.newDocumentBuilder();
}
示例3: initResolver
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
private void initResolver() throws IOException {
CatalogManager catalogManager = new CatalogManager();
catalogManager.setUseStaticCatalog(true);
catalogManager.setIgnoreMissingProperties(true);
catalogManager.setVerbosity(1);
catalogManager.setPreferPublic(true);
CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
Catalog catalog = catalogResolver.getCatalog();
if (catalogFiles != null && catalogFiles.length > 0) {
for (File catalogFile : catalogFiles) {
LOGGER.trace("Using catalog file {}", catalogFile);
catalog.parseCatalog(catalogFile.getPath());
}
} else if (catalogResourceName != null) {
LOGGER.trace("Using catalog from resource: {}", catalogResourceName);
Enumeration<URL> catalogs = Thread.currentThread().getContextClassLoader().getResources(catalogResourceName);
while (catalogs.hasMoreElements()) {
URL catalogResourceUrl = catalogs.nextElement();
LOGGER.trace("Parsing catalog from URL: {}", catalogResourceUrl);
catalog.parseCatalog(catalogResourceUrl);
}
} else {
throw new IllegalStateException("Catalog is not defined");
}
builtinSchemaResolver = catalogResolver;
}
示例4: OGCCapabilitiesResource
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public OGCCapabilitiesResource() throws ParserConfigurationException {
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(false);
builderFactory.setIgnoringElementContentWhitespace(false);
builder = builderFactory.newDocumentBuilder();
builder.setEntityResolver(new CatalogResolver());
}
示例5: CatalogLSResourceResolver
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public CatalogLSResourceResolver(CatalogResolver catalogResolver) {
this.catalogResolver = catalogResolver;
}
示例6: getCatalogResolver
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public CatalogResolver getCatalogResolver() {
return catalogResolver;
}
示例7: setCatalogResolver
import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public void setCatalogResolver(CatalogResolver catalogResolver) {
this.catalogResolver = catalogResolver;
}