cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <>
Subject AW: Xalan2: XpathAPI Problem
Date Thu, 26 Oct 2000 10:24:51 GMT
> Gary L Peskin []
> > 
> > after a successful update to the latest cocoon/xalan2 release, 
> we still have problems with the org.apache.xpath.XPathAPI class:
> > 
> > A method-call XPathAPI.selectSingleNode(testFragment, "test") 
> returns null for the following fragment:
> > 
> > <test>
> >   <a/>
> > </test>
> > 
> > "testFragment" is a DocumentFragment containing the "test"-node.
> The following code (adapted from ApplyXPath) works for me with the
> latest XalanJ2 build from CVS:
This works for me fine, too - even with the Xalan version out of the 
cocoon cvs.

> Perhaps you could include the actual code that's giving you problems and
> we can take a look.

My example is rather complex: I load an xml resource (the cocoon.xconf) and
build a DocumentFragment out of it by using the DOMBuilder class, so that
the first child of this DocumentFragment is the root node of the xml resource.
In this case this is the <cocoon> element.

   n = XPathAPI.selectSingleNode(docFrag, "cocoon"); 

does not work, but

   n = XPathAPI.selectSingleNode(docFrag, "*[local-name()='cocoon']");

works very well.

After a little bit of investigation I found out the really difference between 
your example and mine is the namespaceURI of the node in question.
In your example it is simply null (no object), in my example it is an empty 
string of length 0.
So I assume that the testing of the namespaceURI in XalanJ2 only test for null
or not null and not for an empty string.

I have also attached the example which uses some of the cocoon classes, but I
think you won't need it.

Carsten Ziegeler

Open Source Group              sunShine - Lighting up e:Business
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn                  

View raw message