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


Java XPathFactoryConfigurationException类代码示例

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


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

示例1: createXPathFactory

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
/**
 * Returns properly configured (e.g. security features) factory
 * - securityProcessing == is set based on security processing property, default is true
 */
public static XPathFactory createXPathFactory(boolean disableSecureProcessing) throws IllegalStateException {
    try {
        XPathFactory factory = XPathFactory.newInstance();
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "XPathFactory instance: {0}", factory);
        }
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
        return factory;
    } catch (XPathFactoryConfigurationException ex) {
        LOGGER.log(Level.SEVERE, null, ex);
        throw new IllegalStateException( ex);
    } catch (AbstractMethodError er) {
        LOGGER.log(Level.SEVERE, null, er);
        throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XmlFactory.java

示例2: testExtFuncNotAllowed

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
/**
 * Security is enabled, extension function not allowed
 */
public void testExtFuncNotAllowed() {
    Policy p = new SimplePolicy(new AllPermission());
    Policy.setPolicy(p);
    System.setSecurityManager(new SecurityManager());

    try {
        evaluate(false);
    } catch (XPathFactoryConfigurationException e) {
        fail(e.getMessage());
    } catch (XPathExpressionException ex) {
        //expected since extension function is disallowed
        System.out.println("testExtFuncNotAllowed: OK");
    } finally {
        System.setSecurityManager(null);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:XPathExFuncTest.java

示例3: TrpXPathProcessor

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
public TrpXPathProcessor(final String docBuilderFactoryImpl, final String xPathFactoryImpl) 
		throws XPathFactoryConfigurationException, ParserConfigurationException {
	if(docBuilderFactoryImpl == null || xPathFactoryImpl == null) {
		throw new IllegalArgumentException("Arguments must not be null!");
	}
	classLoader = this.getClass().getClassLoader();
	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(
			docBuilderFactoryImpl, 
			classLoader);
	builder = factory.newDocumentBuilder();
	xPathFactory = XPathFactory.newInstance(
			javax.xml.xpath.XPathFactory.DEFAULT_OBJECT_MODEL_URI, 
			xPathFactoryImpl, 
			classLoader
			);
	xPath = xPathFactory.newXPath();
}
 
开发者ID:Transkribus,项目名称:TranskribusCore,代码行数:18,代码来源:TrpXPathProcessor.java

示例4: createDefaultXPathFactory

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
protected static XPathFactory createDefaultXPathFactory() throws XPathFactoryConfigurationException {
    XPathFactory factory = null;

    // read system property and see if there is a factory set
    Properties properties = System.getProperties();
    for (Map.Entry<Object, Object> prop : properties.entrySet()) {
        String key = (String) prop.getKey();
        if (key.startsWith(XPathFactory.DEFAULT_PROPERTY_NAME)) {
            String uri = ObjectHelper.after(key, ":");
            if (uri != null) {
                factory = XPathFactory.newInstance(uri);
                LOG.info("Using system property {} with value {} when created default XPathFactory {}", new Object[]{key, uri, factory});
            }
        }
    }

    if (factory == null) {
        factory = XPathFactory.newInstance();
        LOG.info("Created default XPathFactory {}", factory);
    }

    return factory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:XPathBuilder.java

示例5: HolidayEndpoint

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
@Autowired
public HolidayEndpoint(HumanResourceService humanResourceService)
		throws JDOMException, XPathFactoryConfigurationException,
		XPathExpressionException {
	this.humanResourceService = humanResourceService;

	Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);

	XPathFactory xPathFactory = XPathFactory.instance();

	this.startDateExpression = xPathFactory.compile("//hr:StartDate",
			Filters.element(), null, namespace);
	this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(),
			null, namespace);
	this.nameExpression = xPathFactory.compile(
			"concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null,
			namespace);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:19,代码来源:HolidayEndpoint.java

示例6: parseCapabilities

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
private WMTSLayerInfo parseCapabilities() throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, XPathFactoryConfigurationException {
	String uri = capabilitiesUrl;
	WMTSCapabilitiesDocument capabilities = new WMTSCapabilitiesDocument(uri);
	
	capabilities.scanTileMatrixSet(tileMatrixSet, new TileMatrixSetScanner() {
		@Override
		public void onTileMatrix(String identifier, double scaleDenom, double ulx, double uly,
				int tileWidth, int tileHeight, int matrixWidth, int matrixHeight) {
			
			tileMatrices.add(
					new WMTSTileMatrix(identifier, scaleDenom, ulx, uly,
							tileWidth, tileHeight, matrixWidth, matrixHeight));
		}
	});
	
	return capabilities.getLayerInfo(layerName);
}
 
开发者ID:opengeospatial,项目名称:geopackager,代码行数:18,代码来源:RealWMTS.java

示例7: isContained

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
private boolean isContained(TestAssertion assertion, String fileLocation)
		throws XPathExpressionException,
		XPathFactoryConfigurationException, XPathException {
	XPathFactory xpathFactory = XPathFactory
			.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON);
	XPathEvaluator xpath = (XPathEvaluator) xpathFactory.newXPath();
	xpath.getConfiguration().setLineNumbering(true);
	xpath.setNamespaceContext(new BpelNamespaceContext());
	XPathExpression expr = xpath.compile(assertion.getTarget());
	InputSource inputSource = new InputSource(
			new File(fileLocation).toString());
	SAXSource saxSource = new SAXSource(inputSource);
	NodeInfo doc = xpath.getConfiguration().buildDocument(saxSource);

	@SuppressWarnings("unchecked")
	List<NodeInfo> matchedLines = (List<NodeInfo>) expr.evaluate(doc,
			XPathConstants.NODESET);
	if (matchedLines.size() > 0) {
		return true;
	}

	return false;
}
 
开发者ID:uniba-dsg,项目名称:bpp,代码行数:24,代码来源:TestRunner.java

示例8: newXPathFactory

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) {
    XPathFactory factory = XPathFactory.newInstance();
    try {
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
    } catch (XPathFactoryConfigurationException e) {
        LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
    }
    return factory;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:XmlUtil.java

示例9: getXPathFactory

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
private static XPathFactory getXPathFactory() throws XPathFactoryConfigurationException {
		if (_xPathFactory==null) {
			String magicValue=System.getProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom");
	    	System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom","net.sf.saxon.xpath.XPathFactoryImpl");
//	    	System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom","org.apache.xpath.jaxp.XPathFactoryImpl");
//	    	System.setProperty("jaxp.debug","yes");
	    	_xPathFactory=XPathFactory.newInstance(XPathConstants.DOM_OBJECT_MODEL);
	    	if (magicValue==null)
	    		System.clearProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom");
	    	else
	    		System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom",magicValue);
		}
		return _xPathFactory;
	}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:15,代码来源:XmlHelper.java

示例10: evaluate

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
void evaluate(boolean enableExt) throws XPathFactoryConfigurationException, XPathExpressionException {
    Document document = getDocument();

    XPathFactory xPathFactory = XPathFactory.newInstance();
    /**
     * Use of the extension function 'http://exslt.org/strings:tokenize' is
     * not allowed when the secure processing feature is set to true.
     * Attempt to use the new property to enable extension function
     */
    if (enableExt) {
        boolean isExtensionSupported = enableExtensionFunction(xPathFactory);
    }

    xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
    if (System.getSecurityManager() == null) {
        xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
    }

    XPath xPath = xPathFactory.newXPath();
    xPath.setNamespaceContext(new MyNamespaceContext());

    String xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
    System.out.println(
            "XPath result (enableExtensionFunction == " + enableExt + ") = \""
            + xPathResult
            + "\"");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:XPathExFuncTest.java

示例11: enableExtensionFunction

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
boolean enableExtensionFunction(XPathFactory factory) {
    boolean isSupported = true;
    try {
        factory.setFeature(ENABLE_EXTENSION_FUNCTIONS, true);
    } catch (XPathFactoryConfigurationException ex) {
        isSupported = false;
    }
    return isSupported;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:XPathExFuncTest.java

示例12: newXPathFactory

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
public static XPathFactory newXPathFactory(boolean disableSecurity) {
    XPathFactory factory = XPathFactory.newInstance();
    try {
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
    } catch (XPathFactoryConfigurationException e) {
        LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
    }
    return factory;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:XmlUtil.java

示例13: createXPath

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
private XPath createXPath() throws XPathFactoryConfigurationException {
    XPathFactory xpathFactory = XPathFactory.newInstance();
    Assert.assertNotNull(xpathFactory);
    XPath xpath = xpathFactory.newXPath();
    Assert.assertNotNull(xpath);
    return xpath;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Bug4992805.java

示例14: newInstance

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
public static PageXmlProcessor newInstance(DocBuilderFactoryImpl docBuilderFactoryImpl, 
		XPathFactoryImpl xPathFactoryImpl) throws XPathFactoryConfigurationException, ParserConfigurationException {
	File store = new File(STORE_LOCATION);
	if(store.isDirectory() && store.canRead()) {
		logger.debug("Returning Instance with netShare access.");
		return buildNetShareInstance(docBuilderFactoryImpl, xPathFactoryImpl);
	} else {
		logger.debug("Returning Instance with HTTPS access.");
		return buildHttpInstance(docBuilderFactoryImpl, xPathFactoryImpl);
	}
}
 
开发者ID:Transkribus,项目名称:TranskribusCore,代码行数:12,代码来源:PageXmlProcessorFactory.java

示例15: buildHttpInstance

import javax.xml.xpath.XPathFactoryConfigurationException; //导入依赖的package包/类
private static PageXmlProcessor buildHttpInstance(DocBuilderFactoryImpl dbImpl, XPathFactoryImpl xpImpl) throws XPathFactoryConfigurationException, ParserConfigurationException {
	return new PageXmlProcessor(dbImpl, xpImpl) {
		@Override
		protected Document loadDocument(final String xmlKey)
				throws MalformedURLException, IllegalArgumentException, SAXException, IOException {
			return super.parse(uriBuilder.getFileUri(xmlKey).toURL());
		}
	};
}
 
开发者ID:Transkribus,项目名称:TranskribusCore,代码行数:10,代码来源:PageXmlProcessorFactory.java


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