net.sf.saxon.xpath.XPathFactoryImpl.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中net.sf.saxon.xpath.XPathFactoryImpl.<init>()方法的一些代码示例,展示了XPathFactoryImpl.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathFactoryImpl.<init>()方法的具体详情如下:
包路径:net.sf.saxon.xpath.XPathFactoryImpl
类名称:XPathFactoryImpl
方法名:<init>

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

  1. @Before
  2. public void before() throws Exception {
  3. XPathFactory xpathFactory = new XPathFactoryImpl();
  4. xpath = xpathFactory.newXPath();
  5. builderFactory = DocumentBuilderFactory.newInstance();
  6. builderFactory.setNamespaceAware(true);
  7. }

代码示例来源:origin: org.mule.modules/mule-module-xml

  1. /**
  2. * {@inheritDoc}
  3. * Returns instances of {@link XPathFactoryImpl}
  4. */
  5. @Override
  6. protected XPathFactory createXPathFactory()
  7. {
  8. return new XPathFactoryImpl();
  9. }
  10. }

代码示例来源:origin: goldmansachs/jdmn

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: goldmansachs/jdmn

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: goldmansachs/jdmn

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: goldmansachs/jdmn

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: goldmansachs/jdmn

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core

  1. private String evaluateXPath(String input, String expression) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
  2. // Read document
  3. String xml = "<root>" + input + "</root>";
  4. DocumentBuilderFactory documentBuilderFactory = new DocumentBuilderFactoryImpl();
  5. DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  6. InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
  7. Document document = docBuilder.parse(inputStream);
  8. // Evaluate xpath
  9. XPathFactory xPathFactory = new XPathFactoryImpl();
  10. XPath xPath = xPathFactory.newXPath();
  11. return xPath.evaluate(expression, document.getDocumentElement());
  12. }

代码示例来源:origin: org.mule.runtime/mule-module-extensions-spring-support

  1. @Before
  2. public void before() throws Exception {
  3. XPathFactory xpathFactory = new XPathFactoryImpl();
  4. xpath = xpathFactory.newXPath();
  5. builderFactory = DocumentBuilderFactory.newInstance();
  6. builderFactory.setNamespaceAware(true);
  7. }

代码示例来源:origin: in.jlibs/jlibs-examples

  1. @Override
  2. public List<Object> evaluate(TestCase testCase, String file) throws Exception{
  3. XPathFactoryImpl xpf = new XPathFactoryImpl();
  4. XPathEvaluator xpe = (XPathEvaluator)xpf.newXPath();
  5. xpe.getConfiguration().setVersionWarning(false);
  6. ((StandardErrorListener)xpe.getConfiguration().getErrorListener()).setRecoveryPolicy(Configuration.RECOVER_SILENTLY);
  7. xpe.getStaticContext().setBackwardsCompatibilityMode(true);
  8. xpe.setXPathVariableResolver(testCase.variableResolver);
  9. xpe.setXPathFunctionResolver(testCase.functionResolver);
  10. xpe.setNamespaceContext(testCase.nsContext);
  11. NodeInfo doc = xpe.getConfiguration().buildDocument(new SAXSource(new InputSource(file)));
  12. List<Object> results = new ArrayList<Object>(testCase.xpaths.size());
  13. for(XPathInfo xpathInfo: testCase.xpaths){
  14. if(xpathInfo.forEach==null)
  15. results.add(xpe.evaluate(xpathInfo.xpath, doc, xpathInfo.resultType));
  16. else{
  17. List<Object> list = new ArrayList<Object>();
  18. List nodeList = (List)xpe.evaluate(xpathInfo.forEach, doc, XPathConstants.NODESET);
  19. for(Object context: nodeList)
  20. list.add(xpe.evaluate(xpathInfo.xpath, context, xpathInfo.resultType));
  21. results.add(list);
  22. }
  23. }
  24. return results;
  25. }

代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-compiler

  1. try {
  2. __log.debug("Compiling expression " + xpathStr);
  3. XPathFactory xpf = new XPathFactoryImpl();
  4. JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(
  5. _compilerContext, out, source.getNamespaceContext(),

相关文章