I've recently needed the same and found the following worked for me. I
had to implement the interface
org.apache.excalibur.xml.xpath.PrefixResolver to get namespace
handling to work and added a setNamespace method so i could add them
as i needed, seems to work for me.

var prefixResolver = new MyPrefixResolver();
prefixResolver.setNamespace("demo", "http://www.demo.com";);
var xpathProcessor =
cocoon.getComponent(Packages.org.apache.excalibur.xml.xpath.XPathProcessor.ROLE);
var node = xpathProcessor.selectSingleNode(doc, "/demo/testnode[1]",
prefixResolver);

Paul

On 7/29/05, Brent Johnson <[EMAIL PROTECTED]> wrote:
> Ahh well.. I just switched to using the XPathProcessor and guessed at
> some of the function calls hoping they were similar to Xalan's
> XPathAPI.  They were, so things are good :)
> 
> - Brent
> 
> On 7/29/05, Brent Johnson <[EMAIL PROTECTED]> wrote:
> > I've seen some older posts from late 2004 that use the
> > org.apache.excalibur.xml.xpath.XPathProcessor to do xpath processing
> > on a document in flow.  I can't seem to find the API docs for this.
> > Is the use of this class not suggested for 2.1.7 or is there a better
> > way to parse XML documents and handle xpath processing in flowscript?
> >
> > I've been able to do it using "Packages.org.apache.xpath.XPathAPI" but
> > wondered if it was better to use a Cocoon component like the
> > XPathProcessor instead.
> >
> > Thanks,
> >
> > - Brent
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to