This seems to be a problem brought about by changes to both JDOM and Jaxen
since the last last beta versions. The Jaxen beta 8 uses a more recent build
of JDOM than JDOM beta 7, which is the latest milestone drop. Because of
this, it is now using JDOM's revamped 'Text' node. This is what happens with
three different versions of Jaxen/JDOM with your example ('/root/x/text()'):

Jaxen beta 7 + JDOM beta 8: A List with one String - 'my text'
Jaxen beta 8 + JDOM beta 8: A List with no items.
Jaxen beta 8 + JDOM post-beta 8: A List with one Text node - 'my text'

The 'jdom.jar' that came with Jaxen beta 8 should return a List of Text
nodes.

Question: Why the change from returning a list of Strings to a list of Text
nodes?

Incidentally, this is also the reason that Morten Vinje was unable to get
Jaxen to compile without changing the 'Text.getText()' method calls to
'Text.getValue()' - sometime after the last JDOM beta, they have changed
Text, removeing the 'getValue()' method and adding a couple of 'getText()'
methods - getText(), getTextTrim() and getTextNormalize(). If you complie
with the jdom.jar from Jaxen beta 8's /lib directory, it should work.

David

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Manjuka
> Soysa
> Sent: Friday, 25 January 2002 10:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [Jaxen] JDOM - text() and name() problem
>
>
> Thanks Christian,
> name() is ok, but text() doesn't work.
> For example if I do /root/x/text(), it returns an
> empty list.
> But if I convert the JDOM document to a DOM document
> and use jaxen.dom.XPath, it returns the expected
> result.
> So it must be a bug in jaxen.jdom.XPath.
> I looked at the source, but there wasn't anything
> obvious.
> regards,
> Manjuka
>
> --- Christian Nentwich <[EMAIL PROTECTED]>
> wrote:
> > > For path = root/x, I get a list with the x
> > element,
> > > but for path = root/x/text() and path =
> > root/x/name()
> > > I get an empty list.
> >
> > Try using /root/x (even though you do pass the
> > document as the context
> > node). Also note that /root/x/name() is not a valid
> > path. If you are
> > looking for the name of a node, use name(/root/x)
> > (but you know that
> > will return 'x' anyway :)
> >
> > Christian
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
>
> _______________________________________________
> Jaxen-interest mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jaxen-interest


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to