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


Java CatalogResolver类代码示例

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

示例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();
}
 
开发者ID:forcedotcom,项目名称:DITA-Unit-Tests,代码行数:23,代码来源:BaseXMLValidationTest.java

示例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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:29,代码来源:SchemaRegistryImpl.java

示例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());
}
 
开发者ID:EsriDE,项目名称:OpenDataBridge,代码行数:9,代码来源:OGCCapabilitiesResource.java

示例5: CatalogLSResourceResolver

import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public CatalogLSResourceResolver(CatalogResolver catalogResolver) {
    this.catalogResolver = catalogResolver;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CatalogLSResourceResolver.java

示例6: getCatalogResolver

import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public CatalogResolver getCatalogResolver() {
    return catalogResolver;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CatalogLSResourceResolver.java

示例7: setCatalogResolver

import org.apache.xml.resolver.tools.CatalogResolver; //导入依赖的package包/类
public void setCatalogResolver(CatalogResolver catalogResolver) {
    this.catalogResolver = catalogResolver;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CatalogLSResourceResolver.java


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