[jdom-interest] Question about selecting nodes with XPath
Paul Libbrecht
paul at activemath.org
Tue Jan 31 14:39:43 PST 2006
You might be encountering the same bugs as I did, namely, that of //elt
seems not to select the child... I think it's a bug of Jaxen. It happens
with both plain Jaxen and JDOM wrapper for it to me. Changing the path
to .//elt worked for me though.
hope that helps.
paul
Michael Kay wrote:
> If you're selecting with the root as context node, //a:displayname will
> select all the a:displayname elements. If you're at the parent of the
> a:displayname element, you can select it using a:displayname. In both cases,
> and this is probably where you're going wrong, you need to ensure that the
> prefix a is bound in the context for the XPath expression. The way you do
> that depends on the API you are using - I don't remember offhand how its
> done in JDOM.
>
> Michael Kay
> http://www.saxonica.com/
>
>
>> -----Original Message-----
>> From: jdom-interest-bounces at jdom.org
>> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Clemens Eisserer
>> Sent: 31 January 2006 20:18
>> To: jdom-interest at jdom.org
>> Subject: [jdom-interest] Question about selecting nodes with XPath
>>
>> Hello,
>>
>> First of all thanks a lot for jdom, its a really well designed API and
>> its fun to work with it.
>>
>> I would like to use XPath for just selecting the
>> "<a:displayname>"-nodes however I tried several ways to do so and I
>> only get a List with size 0 so I guess my query is somehow malformed.
>> I tried "displayname", "/displayname", "a:displayname",
>> "/a:displayname" however none worked.
>>
>> It would be really great if somebody could give me just a short hint
>> whats wrong.
>>
>> Thank you in advance, lg Clemens
>>
>> This is an exmaple XML-File I would like to query:
>> <?xml version="1.0"?><a:multistatus
>> xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
>> xmlns:c="xml:"
>> xmlns:a="DAV:"><a:response><a:href>https://10.0.0.5/exchange/u
>> ser2/Kalender/</a:href><a:propstat><a:status>HTTP/1.1
>> 200
>> OK</a:status><a:prop><a:displayname>Kalender</a:displayname></
>>
> a:prop></a:propstat></a:response><a:response><a:href>>
> https://10.0.0.5/exchange/user2/Kalender/appointment2.eml</a:h
>
>> ref><a:propstat><a:status>HTTP/1.1
>> 200
>> OK</a:status><a:prop><a:displayname>appointment2.eml</a:displa
>>
> yname></a:prop></a:propstat></a:response><a:response><a:href>>
> https://10.0.0.5/exchange/user2/Kalender/{36BB053F-DF6D-4BA4-8
> F04-87F04B6E3031}.EML</a:href><a:propstat><a:status>HTTP/1.1
>
>> 200
>> OK</a:status><a:prop><a:displayname>{36BB053F-DF6D-4BA4-8F04-8
>>
> 7F04B6E3031}.EML</a:displayname></a:prop></a:propstat></a:response><a:respon
> se><a:href>> https://10.0.0.5/exchange/user2/Kalender/{144246DB-94E9-46E8-9
>
>> 81E-BEACB7A2012F}.EML</a:href><a:propstat><a:status>HTTP/1.1
>> 200
>> OK</a:status><a:prop><a:displayname>{144246DB-94E9-46E8-981E-B
>>
> EACB7A2012F}.EML</a:displayname></a:prop></a:propstat></a:response></a:multi
> status>
>
>> _______________________________________________
>> To control your jdom-interest membership:
>> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
>> rhost.com
>>
>>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>
>
More information about the jdom-interest
mailing list