xpath - Select element and its descendants -


i'm trying select folder , descendants jcr xpath. can select folder enough:

//content/documents/folder-name 

i can select descendants too:

//content/documents/folder-name//* 

however, can't figure out how both. i've tried several things. these select nothing:

//content/documents/folder-name | //content/documents/folder-name//* //content/documents/folder-name(. | *) //content/documents/folder-name/(. | *) //content/documents/folder-name/descendant-or-self //content/documents/folder-name/descendant-or-self::node() 

these both throw javax.jcr.query.invalidqueryexception:

//content/documents/folder-name[. | *] //content/documents/folder-name/[. | *] 

obviously i'm terrible @ xpath. please help.

edit: using // prefix because didn't realize use /jcr:root/content instead. have same problem that, however.

you can combine 2 xpaths using union operator:

xpath1 | xpath2 

however, first xpath,

//content/documents/folder-name 

does select folder-name element(s), includes descendants of element.

if want folder-name elements first in list, followed descendants, combine follows:

//content/documents/folder-name | //content/documents/folder-name//* 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -