org.apache.xpath.objects.XObject.nodeset()方法的使用及代码示例

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

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

XObject.nodeset介绍

[英]Cast result object to a nodelist. Always issues an error.
[中]将结果对象强制转换为节点列表。总是发出错误。

代码示例

代码示例来源:origin: robovm/robovm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public static NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: robovm/robovm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public  NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: xalan/xalan

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public  NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: xalan/xalan

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public static NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: robovm/robovm

private Object getResultAsType( XObject resultObject, QName returnType )
  throws javax.xml.transform.TransformerException {
  // XPathConstants.STRING
  if ( returnType.equals( XPathConstants.STRING ) ) { 
    return resultObject.str();
  }
  // XPathConstants.NUMBER
  if ( returnType.equals( XPathConstants.NUMBER ) ) { 
    return new Double ( resultObject.num());
  }
  // XPathConstants.BOOLEAN
  if ( returnType.equals( XPathConstants.BOOLEAN ) ) { 
    return new Boolean( resultObject.bool());
  }
  // XPathConstants.NODESET ---ORdered, UNOrdered???
  if ( returnType.equals( XPathConstants.NODESET ) ) { 
    return resultObject.nodelist();
  }
  // XPathConstants.NODE
  if ( returnType.equals( XPathConstants.NODE ) ) { 
    NodeIterator ni = resultObject.nodeset(); 
    //Return the first node, or null
    return ni.nextNode();
  }
  String fmsg = XSLMessages.createXPATHMessage(
      XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE,
      new Object[] { returnType.toString()});
  throw new IllegalArgumentException( fmsg );
}

代码示例来源:origin: robovm/robovm

NodeIterator ni = resultObject.nodeset();

代码示例来源:origin: xalan/xalan

private Object getResultAsType( XObject resultObject, QName returnType )
  throws javax.xml.transform.TransformerException {
  // XPathConstants.STRING
  if ( returnType.equals( XPathConstants.STRING ) ) { 
    return resultObject.str();
  }
  // XPathConstants.NUMBER
  if ( returnType.equals( XPathConstants.NUMBER ) ) { 
    return new Double ( resultObject.num());
  }
  // XPathConstants.BOOLEAN
  if ( returnType.equals( XPathConstants.BOOLEAN ) ) { 
    return resultObject.bool() ? Boolean.TRUE : Boolean.FALSE;
  }
  // XPathConstants.NODESET ---ORdered, UNOrdered???
  if ( returnType.equals( XPathConstants.NODESET ) ) { 
    return resultObject.nodelist();
  }
  // XPathConstants.NODE
  if ( returnType.equals( XPathConstants.NODE ) ) { 
    NodeIterator ni = resultObject.nodeset(); 
    //Return the first node, or null
    return ni.nextNode();
  }
  String fmsg = XSLMessages.createXPATHMessage(
      XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE,
      new Object[] { returnType.toString()});
  throw new IllegalArgumentException( fmsg );
}

代码示例来源:origin: xalan/xalan

NodeIterator ni = resultObject.nodeset();

代码示例来源:origin: plutext/docx4j

NodeIterator ni = xo.nodeset();
result = ni.nextNode();
Node nextNode = ni.nextNode();
result = xo.nodeset().nextNode();

代码示例来源:origin: xalan/xalan

result = m_resultObj.nodeset();
} catch (TransformerException te) {
  throw new XPathException(XPathException.TYPE_ERR,te.getMessage());

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

NodeListModel result = new NodeListModel(node);
result.xpathSupport = this;
NodeIterator nodeIterator = xresult.nodeset();
Node n;
do {

代码示例来源:origin: xalan/xalan

(javaClass == java.lang.Object.class) )
return xobj.nodeset();

代码示例来源:origin: xalan/xalan

m_iterator = m_resultObj.nodeset();
} catch (TransformerException te) {

代码示例来源:origin: MobiVM/robovm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public static NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: MobiVM/robovm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public  NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: ibinti/bugvm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public static NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: ibinti/bugvm

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public  NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

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

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public static NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 *  Use an XPath string to select a nodelist.
 *  XPath namespace prefixes are resolved from the namespaceNode.
 *
 *  @param contextNode The node to start searching from.
 *  @param str A valid XPath string.
 *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
 *  @return A NodeIterator, should never be null.
 *
 * @throws TransformerException
 */
public  NodeIterator selectNodeIterator(
    Node contextNode, String str, Node namespaceNode)
     throws TransformerException
{
 // Execute the XPath, and have it return the result
 XObject list = eval(contextNode, str, namespaceNode);
 // Have the XObject return its result as a NodeSetDTM.                
 return list.nodeset();
}

代码示例来源:origin: org.apache.taglibs/com.springsource.org.apache.taglibs.standard

/**
 * Returns a NodeIterator from an XObject.
 *  @param list The XObject from which a NodeIterator is returned.
 *  @return A NodeIterator, should never be null.
 *  @throws JspTagException
 */
private static NodeIterator getNodeIterator(XObject list) 
throws JspTagException {
  try {
    return list.nodeset();
  } catch (TransformerException ex) {
    throw new JspTagException(
      Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);            
  }
}

相关文章