• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLCatalogResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MCREntityResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
private MCREntityResolver() {
    Enumeration<URL> systemResources;
    try {
        systemResources = this.getClass().getClassLoader().getResources("catalog.xml");
    } catch (IOException e) {
        throw new ExceptionInInitializerError(e);
    }
    Vector<String> catalogURIs = new Vector<>();
    while (systemResources.hasMoreElements()) {
        URL catalogURL = systemResources.nextElement();
        LOGGER.info("Using XML catalog: {}", catalogURL);
        catalogURIs.add(catalogURL.toString());
    }
    String[] catalogs = catalogURIs.toArray(new String[catalogURIs.size()]);
    catalogResolver = new XMLCatalogResolver(catalogs);
    int cacheSize = MCRConfiguration.instance().getInt(CONFIG_PREFIX + "StaticFiles.CacheSize", 100);
    bytesCache = new MCRCache<>(cacheSize, "EntityResolver Resources");
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:19,代码来源:MCREntityResolver.java


示例2: setupClassFixture

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Obtains the test subject from the ISuite context and creates a
 * catalog-based resource resolver. The suite attribute
 * {@link org.opengis.cite.osxgeotime.SuiteAttribute#TEST_SUBJECT} should evaluate
 * to a DOM Document node.
 *
 * @param testContext
 *            The test (group) context.
 */
@BeforeClass
public void setupClassFixture(ITestContext testContext) {
    Object obj = testContext.getSuite().getAttribute(
            SuiteAttribute.TEST_SUBJECT.getName());
    if ((null != obj) && Document.class.isAssignableFrom(obj.getClass())) {
        this.testSubject = Document.class.cast(obj);
    }

    Object objRnc = testContext.getSuite().getAttribute(
            SuiteAttribute.RELAX_NG.getName());

    if ((null != objRnc) && String.class.isAssignableFrom(objRnc.getClass())) {
        this.rncFile = String.class.cast(objRnc);
    }

    URL catalog = getClass().getResource(ENTITY_CATALOG);
    String[] catalogList = new String[] { catalog.toString() };
    this.resolver = new XMLCatalogResolver(catalogList);
}
 
开发者ID:opengeospatial,项目名称:ets-osxgeotime10,代码行数:29,代码来源:RelaxNGTest.java


示例3: CatalogResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
public CatalogResolver( boolean throwIfNotFound, List<String> catalogs, boolean preferPublic )
{
    this.throwIfNotFound = throwIfNotFound;
    delegate.setCatalogList( catalogs.toArray( new String[ catalogs.size() ] ) );
    delegate.setPreferPublic( preferPublic );
    if( LOG.isDebugEnabled() )
    {
        try
        {
            Field catalogManagerField = XMLCatalogResolver.class.getDeclaredField( "fResolverCatalogManager" );
            catalogManagerField.setAccessible( true );
            CatalogManager catalogManager = (CatalogManager) catalogManagerField.get( delegate );
            catalogManager.setVerbosity( Integer.MAX_VALUE );
            catalogManager.debug = new Debug();
            catalogManagerField.setAccessible( false );
        }
        catch( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex )
        {
            LOG.warn(
                "Unable to setup XML-Catalog resolution logging, something is broken, please report the issue!",
                ex
            );
        }
    }
}
 
开发者ID:werval,项目名称:werval,代码行数:26,代码来源:CatalogResolver.java


示例4: initCatalogResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
private static XMLCatalogResolver initCatalogResolver() {
    URL catalogURL = ValidationUtils.class
            .getResource("/org/opengis/cite/osxgeotime/schematron-catalog.xml");
    XMLCatalogResolver resolver = new XMLCatalogResolver();
    resolver.setCatalogList(new String[] { catalogURL.toString() });
    return resolver;
}
 
开发者ID:opengeospatial,项目名称:ets-osxgeotime10,代码行数:8,代码来源:ValidationUtils.java


示例5: setupClassFixture

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Obtains the test subject from the ISuite context and creates a
 * catalog-based resource resolver. The suite attribute
 * {@link org.opengis.cite.osxgeotime.SuiteAttribute#TEST_SUBJECT} should evaluate
 * to a DOM Document node.
 *
 * @param testContext
 *            The test (group) context.
 */
@BeforeClass
public void setupClassFixture(ITestContext testContext) {
    Object obj = testContext.getSuite().getAttribute(
            SuiteAttribute.TEST_SUBJECT.getName());
    if ((null != obj) && Document.class.isAssignableFrom(obj.getClass())) {
        this.testSubject = Document.class.cast(obj);
    }
    URL catalog = getClass().getResource(ENTITY_CATALOG);
    String[] catalogList = new String[] { catalog.toString() };
    this.resolver = new XMLCatalogResolver(catalogList);
}
 
开发者ID:opengeospatial,项目名称:ets-osxgeotime10,代码行数:21,代码来源:ConceptualModelTests.java


示例6: specifyXmlCatalog

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Initialize XML Catalog Resolver.<br />
 * @see <a href="http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/util/XMLCatalogResolver.html"
 * >XMLCatalogResolver</a>
 */
private void specifyXmlCatalog() {
    if (useXmlCatalog && (xmlCatalogList != null)) {
        // Create catalog resolver.
        XMLCatalogResolver resolver = new XMLCatalogResolver();
        this.resolver = resolver;
        // Set public identifier matches are preferred to system identifier matches
        resolver.setPreferPublic(true);
        // catalog list should be set from the Spring config file
        resolver.setCatalogList(xmlCatalogList);
        // Set the resolver on the parser.
        properties.put("http://apache.org/xml/properties/internal/entity-resolver", resolver);            
    }
}
 
开发者ID:opf-labs,项目名称:jhove2,代码行数:19,代码来源:SaxParser.java


示例7: normalizeSchema

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Escribe un schemaRef valido en el documento
 * 
 * @param inputStreamDocument documento con la instancia XBRL.
 * @param taxonomyRoot ruta de la taxonom�a.
 * @param ouputStreamXML documento de salida.
 * @throws XBRLENLOCException si se produce un error.
 */
public static void normalizeSchema(InputStream inputStreamDocument, String taxonomyRoot,
        ByteArrayOutputStream ouputStreamXML) throws XBRLENLOCException {
	try {
		String physicalUri = null;
		String logicalUri = null;

		System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
		        "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");

		javax.xml.parsers.DocumentBuilderFactory dfactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
		dfactory.setNamespaceAware(true);
		dfactory.setIgnoringElementContentWhitespace(true);
		Document doc = dfactory.newDocumentBuilder().parse(inputStreamDocument);

		DeferredElementNSImpl schemaRefNode = (DeferredElementNSImpl) doc.getDocumentElement()
		        .getElementsByTagNameNS("http://www.xbrl.org/2003/linkbase", "schemaRef").item(0);
		if(schemaRefNode != null) {
			logicalUri = schemaRefNode.getAttributeNS("http://www.w3.org/1999/xlink", "href");
		}

		if((logicalUri == null) || (logicalUri.trim().equals(""))) {
			throw new XBRLENLOCException("notFoundSchemaRefInTheInstance", new String[] {});
		}

		if(logicalUri.startsWith("http")) {
			XMLCatalogResolver catalog = XbrlApiConfiguration.getInstance().getResolver();
			String resolvedUri = catalog.resolveSystem(logicalUri);
			if((resolvedUri == null) || (resolvedUri.startsWith("http"))) {
				throw new XBRLENLOCException(XBRLENLOCException.canNotResolveSchemaRef, new String[] { logicalUri });
			}
			physicalUri = new File(new java.net.URL(resolvedUri).getPath()).getName();

			physicalUri = taxonomyRoot + physicalUri;

			doc.getDocumentElement().removeAttributeNS("http://www.w3.org/2001/XMLSchema-instance",
			        "schemaLocation");

			schemaRefNode.setAttributeNS("http://www.w3.org/1999/xlink", "href", physicalUri);
		}
		/*
		 * LENLOC L�neas a�adidas para poder utilizar la taxonom�a en el
		 * directorio '/taxonomy'
		 */
		//
		else {
			physicalUri = taxonomyRoot + logicalUri;

			doc.getDocumentElement().removeAttributeNS("http://www.w3.org/2001/XMLSchema-instance",
			        "schemaLocation");

			schemaRefNode.setAttributeNS("http://www.w3.org/1999/xlink", "href", physicalUri);
		}
		//
		/* FIN LENLOC - Final de l�neas a�adidas */
		saveXML(doc, ouputStreamXML);

	} catch(XBRLENLOCException ex) {
		throw ex;

	} catch(Exception e) {
		throw new XBRLENLOCException("errorNormalizeSchema", new String[] {}, e);
	}
}
 
开发者ID:xbrles,项目名称:lenloc-penloc,代码行数:72,代码来源:ENLOCUtils.java


示例8: PrimedTransformer

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Default constructor.
 * 
 * @throws ParserConfigurationException
 *             if there's a problem instantiating a DocumentBuilder.
 * @throws TransformerConfigurationException
 *             if there's a problem instantiating a Transformer.
 */
public PrimedTransformer() throws ParserConfigurationException, TransformerConfigurationException {

	// Configure and store a re-usable DocumentBuilderFactory
	this.documentBuilderFactory = PrimedTransformer.newDocumentBuilderFactory();

	// Instantiate and store a re-usable DocumentBuilder
	this.documentBuilder = this.documentBuilderFactory.newDocumentBuilder();

	// Instantiate and store a re-usable XMLCatalogResolver
	this.catalogResolver = new XMLCatalogResolver();

	// Set the default XSL stylesheet to null.
	this.stylesheet = null;

	// Set the parameters of the XSL stylesheet to an empty collection.
	this.stylesheetParameters = new TreeMap<String, String>();

	// Configure and store a re-usable TransformerFactory
	this.transformerFactory = PrimedTransformer.newTransformerFactory();

	// Instantiate and store a re-usable Transformer
	this.setTransformer();

}
 
开发者ID:martian-a,项目名称:willow,代码行数:33,代码来源:PrimedTransformer.java


示例9: getCatalogResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * @return the CatalogResolver used by this instance of PrimedTransformer.
 */
public XMLCatalogResolver getCatalogResolver() {
	return this.catalogResolver;
}
 
开发者ID:martian-a,项目名称:willow,代码行数:7,代码来源:PrimedTransformer.java


示例10: testPrimedTransformer_setCatalogResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Check that the entity resolver is correctly set to the instance
 * specified.
 */
@Test
public void testPrimedTransformer_setCatalogResolver() {

	XMLCatalogResolver resolver = new XMLCatalogResolver(new String[] { catalog.toURI().toString() });
	transformer.setCatalogResolver(resolver);

	assertEquals(resolver, transformer.getCatalogResolver());

}
 
开发者ID:martian-a,项目名称:willow,代码行数:14,代码来源:TestPrimedTransformer.java


示例11: getResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * 
 * 
 * Devuelve el objeto resolver del cat�logo.
 * 
 * @return objeto XMLCatalogResolver.
 * 
 */
public final XMLCatalogResolver getResolver() {
	return resolver;
}
 
开发者ID:xbrles,项目名称:lenloc-penloc,代码行数:12,代码来源:XbrlApiConfiguration.java


示例12: setCatalogResolver

import org.apache.xerces.util.XMLCatalogResolver; //导入依赖的package包/类
/**
 * Changes the instance of CatalogResolver used by this instance of
 * PrimedTransformer.
 * 
 * @param resolver
 *            the CatalogResolver to use when building DOM Documents.
 */
public void setCatalogResolver(XMLCatalogResolver resolver) {
	this.catalogResolver = resolver;
	this.documentBuilder.setEntityResolver(this.catalogResolver);
}
 
开发者ID:martian-a,项目名称:willow,代码行数:12,代码来源:PrimedTransformer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GOST3410Parameters类代码示例发布时间:2022-05-23
下一篇:
Java PieGraph类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap