Hmm, I just read the detailed Javadocs and it says the following:

nodelist
public NodeList nodelist()
                  throws TransformerException
Cast result object to a nodelist. Always issues an error.
Returns:
null
Throws:
TransformerException -  



Is this correct?  Seems silly to have a method that never works.  If this
doesn't work, then how do I get a NodeList from an XObject?

Scott


-----Original Message-----
From: Scott Moore [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 2:13 PM
To: '[EMAIL PROTECTED]'
Subject: RE: XPathAPI help needed


Okay, If I want the equivalent of selectSingleNode() or selectNodeList(), is
this the correct way to do it?

selectSingleNode
----------------
XPathAPI.eval(mynode, xpathexp, new
PrefixResolverDefault(contextNode)).nodelist().item(0);


selectNodeList
--------------
XPathAPI.eval(mynode, xpathexp, new
PrefixResolverDefault(contextNode)).nodelist();



Thanks again,
Scott


-----Original Message-----
From: Paul Brown [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 2:13 PM
To: [EMAIL PROTECTED]
Subject: RE: XPathAPI help needed



> [Scott.Moore at netDecide.com]
> Subject: RE: XPathAPI help needed
> I've tried what you suggested, but it won't compile because the
> namespaceNode (3rd parameter) must be of type Node.  For instance, 
>     Node n = XPathAPI.selectSingleNode(currentNode, xpath, 
>           new org.apache.xml.utils.PrefixResolverDefault(contextNode));
> doesn't compile.
> What am I missing here?

Use the eval() method instead.  Javadoc is at:

http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html

        -- PB

Reply via email to