本文整理了Java中net.sf.saxon.xpath.XPathFactoryImpl.<init>()
方法的一些代码示例,展示了XPathFactoryImpl.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathFactoryImpl.<init>()
方法的具体详情如下:
包路径:net.sf.saxon.xpath.XPathFactoryImpl
类名称:XPathFactoryImpl
方法名:<init>
[英]Default constructor: this creates a Configuration as well as creating the XPathFactory. Any documents accessed using this XPathFactory must be built using this same Configuration.
[中]默认构造函数:这将创建一个配置以及XPathFactory。使用此XPathFactory访问的任何文档都必须使用相同的配置生成。
代码示例来源:origin: mulesoft/mule
@Before
public void before() throws Exception {
XPathFactory xpathFactory = new XPathFactoryImpl();
xpath = xpathFactory.newXPath();
builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
}
代码示例来源:origin: org.mule.modules/mule-module-xml
/**
* {@inheritDoc}
* Returns instances of {@link XPathFactoryImpl}
*/
@Override
protected XPathFactory createXPathFactory()
{
return new XPathFactoryImpl();
}
}
代码示例来源:origin: goldmansachs/jdmn
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: goldmansachs/jdmn
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: goldmansachs/jdmn
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: goldmansachs/jdmn
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: goldmansachs/jdmn
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
// Read document
String xml = "<root>" + input + "</root>";
DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
Document document = docBuilder.parse(inputStream);
// Evaluate xpath
XPathFactory xPathFactory = new XPathFactoryImpl();
XPath xPath = xPathFactory.newXPath();
return xPath.evaluate(expression, document.getDocumentElement());
}
代码示例来源:origin: org.mule.runtime/mule-module-extensions-spring-support
@Before
public void before() throws Exception {
XPathFactory xpathFactory = new XPathFactoryImpl();
xpath = xpathFactory.newXPath();
builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
}
代码示例来源:origin: in.jlibs/jlibs-examples
@Override
public List<Object> evaluate(TestCase testCase, String file) throws Exception{
XPathFactoryImpl xpf = new XPathFactoryImpl();
XPathEvaluator xpe = (XPathEvaluator)xpf.newXPath();
xpe.getConfiguration().setVersionWarning(false);
((StandardErrorListener)xpe.getConfiguration().getErrorListener()).setRecoveryPolicy(Configuration.RECOVER_SILENTLY);
xpe.getStaticContext().setBackwardsCompatibilityMode(true);
xpe.setXPathVariableResolver(testCase.variableResolver);
xpe.setXPathFunctionResolver(testCase.functionResolver);
xpe.setNamespaceContext(testCase.nsContext);
NodeInfo doc = xpe.getConfiguration().buildDocument(new SAXSource(new InputSource(file)));
List<Object> results = new ArrayList<Object>(testCase.xpaths.size());
for(XPathInfo xpathInfo: testCase.xpaths){
if(xpathInfo.forEach==null)
results.add(xpe.evaluate(xpathInfo.xpath, doc, xpathInfo.resultType));
else{
List<Object> list = new ArrayList<Object>();
List nodeList = (List)xpe.evaluate(xpathInfo.forEach, doc, XPathConstants.NODESET);
for(Object context: nodeList)
list.add(xpe.evaluate(xpathInfo.xpath, context, xpathInfo.resultType));
results.add(list);
}
}
return results;
}
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-compiler
try {
__log.debug("Compiling expression " + xpathStr);
XPathFactory xpf = new XPathFactoryImpl();
JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(
_compilerContext, out, source.getNamespaceContext(),
内容来源于网络,如有侵权,请联系作者删除!