本文整理了Java中org.apache.xpath.objects.XObject.nodelist()
方法的一些代码示例,展示了XObject.nodelist()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XObject.nodelist()
方法的具体详情如下:
包路径:org.apache.xpath.objects.XObject
类名称:XObject
方法名:nodelist
[英]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 NodeList selectNodeList(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Execute the XPath, and have it return the result
XObject list = eval(contextNode, str, namespaceNode);
// Return a NodeList.
return list.nodelist();
}
代码示例来源: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 NodeList selectNodeList(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Execute the XPath, and have it return the result
XObject list = eval(contextNode, str, namespaceNode);
// Return a NodeList.
return list.nodelist();
}
代码示例来源: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 NodeList selectNodeList(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Execute the XPath, and have it return the result
XObject list = eval(contextNode, str, namespaceNode);
// Return a NodeList.
return list.nodelist();
}
代码示例来源: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 NodeList selectNodeList(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Execute the XPath, and have it return the result
XObject list = eval(contextNode, str, namespaceNode);
// Return a NodeList.
return list.nodelist();
}
代码示例来源: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
return resultObject.nodelist();
代码示例来源: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
return resultObject.nodelist();
代码示例来源:origin: xalan/xalan
return xobj.nodelist();
代码示例来源:origin: xalan/xalan
(m_resultType == ORDERED_NODE_SNAPSHOT_TYPE)) {
try {
m_list = m_resultObj.nodelist();
} catch (TransformerException te) {
代码示例来源:origin: org.apache.xmlgraphics/batik-dom
/**
* Converts an XObject to a node iterator XPathResult.
*/
protected Result convertNodeIterator(XObject xo, short type)
throws javax.xml.transform.TransformerException {
return new Result(xo.nodelist(), type);
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* Converts an XObject to a node iterator XPathResult.
*/
protected Result convertNodeIterator(XObject xo, short type)
throws javax.xml.transform.TransformerException {
return new Result(xo.nodelist(), type);
}
代码示例来源:origin: org.apache.xmlgraphics/batik-dom
/**
* Converts an XObject to a single node XPathResult.
*/
protected Result convertSingleNode(XObject xo, short type)
throws javax.xml.transform.TransformerException {
return new Result(xo.nodelist().item(0), type);
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* Converts an XObject to a single node XPathResult.
*/
protected Result convertSingleNode(XObject xo, short type)
throws javax.xml.transform.TransformerException {
return new Result(xo.nodelist().item(0), type);
}
代码示例来源:origin: apache/batik
/**
* Converts an XObject to a node iterator XPathResult.
*/
protected Result convertNodeIterator(XObject xo, short type)
throws javax.xml.transform.TransformerException {
return new Result(xo.nodelist(), type);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* Extract NodeList using expression
* @param document {@link Document}
* @param xPathExpression XPath expression
* @return {@link NodeList}
* @throws TransformerException when the internally used xpath engine fails
*/
public static NodeList selectNodeList(Document document, String xPathExpression) throws TransformerException {
XObject xObject = XPathAPI.eval(document, xPathExpression, getPrefixResolver(document));
return xObject.nodelist();
}
代码示例来源:origin: org.seasar.robot/s2-robot
protected NodeList getNodeList(final Document doc, final String xpath)
throws TransformerException {
final DefaultPrefixResolver prefixResolver =
new DefaultPrefixResolver(doc.getNodeType() == Node.DOCUMENT_NODE
? doc.getDocumentElement() : doc);
return getXPathAPI().eval(doc, xpath, prefixResolver).nodelist();
}
代码示例来源:origin: org.codelibs.fess/fess-crawler
protected NodeList getNodeList(final Document doc, final String xpath)
throws TransformerException {
final DefaultPrefixResolver prefixResolver = new DefaultPrefixResolver(
doc.getNodeType() == Node.DOCUMENT_NODE ? doc
.getDocumentElement() : doc);
return getXPathAPI().eval(doc, xpath, prefixResolver).nodelist();
}
代码示例来源:origin: org.codelibs.robot/s2-robot
protected NodeList getNodeList(final Document doc, final String xpath)
throws TransformerException {
final DefaultPrefixResolver prefixResolver =
new DefaultPrefixResolver(doc.getNodeType() == Node.DOCUMENT_NODE
? doc.getDocumentElement() : doc);
return getXPathAPI().eval(doc, xpath, prefixResolver).nodelist();
}
代码示例来源:origin: org.codelibs.robot/s2robot
protected NodeList getNodeList(final Document doc, final String xpath)
throws TransformerException {
final DefaultPrefixResolver prefixResolver = new DefaultPrefixResolver(
doc.getNodeType() == Node.DOCUMENT_NODE ? doc
.getDocumentElement() : doc);
return getXPathAPI().eval(doc, xpath, prefixResolver).nodelist();
}
内容来源于网络,如有侵权,请联系作者删除!