com.sun.org.apache.xpath.internal.XPath.execute()方法的使用及代码示例

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

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

XPath.execute介绍

[英]Given an expression and a context, evaluate the XPath and return the result.
[中]给定表达式和上下文,计算XPath并返回结果。

代码示例

代码示例来源:origin: org.freemarker/freemarker

XPath xpath = new XPath(xpathQuery, null, customPrefixResolver, XPath.SELECT, null);
int ctxtNode = xpathContext.getDTMHandleFromNode(node);
XObject xresult = xpath.execute(xpathContext, ctxtNode, customPrefixResolver);
if (xresult instanceof XNodeSet) {
  NodeListModel result = new NodeListModel(node);

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/**
 * Given an expression and a context, evaluate the XPath
 * and return the result.
 * 
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 * @param namespaceContext The context in which namespaces in the
 * XPath are supposed to be expanded.
 *
 * @return The result of the XPath or null if callbacks are used.
 * @throws TransformerException thrown if
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public XObject execute(
    XPathContext xctxt, org.w3c.dom.Node contextNode, 
    PrefixResolver namespaceContext)
     throws javax.xml.transform.TransformerException
{
 return execute(
    xctxt, xctxt.getDTMHandleFromNode(contextNode), 
    namespaceContext);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

/**
 * Given an expression and a context, evaluate the XPath
 * and return the result.
 * 
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 * @param namespaceContext The context in which namespaces in the
 * XPath are supposed to be expanded.
 *
 * @return The result of the XPath or null if callbacks are used.
 * @throws TransformerException thrown if
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public XObject execute(
    XPathContext xctxt, org.w3c.dom.Node contextNode, 
    PrefixResolver namespaceContext)
     throws javax.xml.transform.TransformerException
{
 return execute(
    xctxt, xctxt.getDTMHandleFromNode(contextNode), 
    namespaceContext);
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

private XObject eval ( Object contextItem )
    throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else {
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
  XObject xobj = null;
   
  Node contextNode = (Node)contextItem;
  // We always need to have a ContextNode with Xalan XPath implementation
  // To allow simple expression evaluation like 1+1 we are setting 
  // dummy Document as Context Node
  
  if ( contextNode == null ) 
    xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
  else
    xobj = xpath.execute(xpathSupport, contextNode, prefixResolver); 
  
  return xobj;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

private XObject eval ( Object contextItem )
    throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else {
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
  XObject xobj = null;
   
  Node contextNode = (Node)contextItem;
  // We always need to have a ContextNode with Xalan XPath implementation
  // To allow simple expression evaluation like 1+1 we are setting 
  // dummy Document as Context Node
  
  if ( contextNode == null ) 
    xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
  else
    xobj = xpath.execute(xpathSupport, contextNode, prefixResolver); 
  
  return xobj;
}

代码示例来源:origin: org.glassfish.web/jstl-impl

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider jep = 
        new com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: javax.servlet/com.springsource.javax.servlet.jsp.jstl

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider jep = 
        new com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: org.eclipse.jetty.orbit/org.apache.taglibs.standard.glassfish

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider jep = 
        new com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: org.bluestemsoftware.open.maven.tparty/jsp-api-2.1

private XObject eval(String expression, Object contextItem)
  throws javax.xml.transform.TransformerException {
  com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
    null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT ); 
  com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
  if ( functionResolver != null ) {
    com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider jep = 
        new com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider(
        functionResolver, featureSecureProcessing );
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
  } else { 
    xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
  }
  XObject xobj = null;
  
  xpathSupport.setVarStack(new com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack(variableResolver));
  
  // If item is null, then we will create a a Dummy contextNode
  if ( contextItem instanceof Node ) {
    xobj = xpath.execute (xpathSupport, (Node)contextItem,
        prefixResolver );
  } else {
    xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
  }
  return xobj;
}

代码示例来源:origin: org.freemarker/com.springsource.freemarker

XPath xpath = new XPath(xpathQuery, null, customPrefixResolver, XPath.SELECT, null);
int ctxtNode = xpathContext.getDTMHandleFromNode(node);
XObject xresult = xpath.execute(xpathContext, ctxtNode, customPrefixResolver);
if (xresult instanceof XNodeSet) {
  NodeListModel result = new NodeListModel(node);

代码示例来源:origin: org.freemarker/freemarker-gae

XPath xpath = new XPath(xpathQuery, null, customPrefixResolver, XPath.SELECT, null);
int ctxtNode = xpathContext.getDTMHandleFromNode(node);
XObject xresult = xpath.execute(xpathContext, ctxtNode, customPrefixResolver);
if (xresult instanceof XNodeSet) {
  NodeListModel result = new NodeListModel(node);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

XPath xpath = new XPath(xpathQuery, null, customPrefixResolver, XPath.SELECT, null);
int ctxtNode = xpathContext.getDTMHandleFromNode(node);
XObject xresult = xpath.execute(xpathContext, ctxtNode, customPrefixResolver);
if (xresult instanceof XNodeSet) {
  NodeListModel result = new NodeListModel(node);

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

XPath.SELECT);
return dynamicXPath.execute(xctxt, myContext.getContextNode(),
              xctxt.getNamespaceContext());

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

XPath.SELECT);
return dynamicXPath.execute(xctxt, myContext.getContextNode(),
              xctxt.getNamespaceContext());

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

xctxt.getNamespaceContext(),
                XPath.SELECT);
result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri

xctxt.getNamespaceContext(),
                XPath.SELECT);
result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num();

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

xctxt.getNamespaceContext(),
                XPath.SELECT);
result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num();

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

xctxt.getNamespaceContext(),
                XPath.SELECT);
result = dynamicXPath.execute(xctxt, contextNode, xctxt.getNamespaceContext()).num();

相关文章