With the new support for the child axis in jackrabbit 1.2.1 you can execute the
following query:
//element(*, x:base)[jcr:content/@jcr:primaryType = 'x:file' or
jcr:content/@jcr:primaryType = 'x:atach']
For your usecase the following query would probably be more useful, but is
currently not supported by jackrabbit:
//element(*, x:base)[jcr:content/element(*, x:file')]
regards
marcel
ps: for future questions on how to use jackrabbit please write to the jackrabbit
user list.
hsp wrote:
Hi all;
I would to get some help with this;
I need to search nodes that have child nodes of certain type.
For example, let's suppose I have the following hierarchy of node type:
x:base
|
x:file
|
x:atach
So, the nodetype x:file has a child of nt:resource mandatory (jcr:content)
and the x:atach inherits the child definition of your supernode, ok.
So, I want to know the x:base, or whatever, that have any child node of type
x:file (and descendents), because x:file and descents have the child
jcr:content for sure, in xpath or sql, I would appreciate very much. Follow
some explanation about:
________________
|Node1(x:base)|
|______________|
|
|____________
| _______|_______
| |Node2(x:base)|
| |______________|
_______|_______ |___________
|Node3(x:base)| ________|_______
|______________| |Node4(x:file) |
| |______________|
_______|________
|Node5(x:atach)|
|______________|
This hierarchy of nodes created can represent my need. So, with a search up
to Node1, I would like to get Node3 and Node2, because both have child nodes
like type x:file.
In time, I need the child nodes of type x:file in results too.
Hope this could do the right explanation.
Helio.