You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This page contains some example XPath*** queries that can be used in the [JCR browser].

 Don't forget to look at the online help in the JCR Browser, it contains a lot of extra tips.

  • ll templates:
    //element(*, wm:template)
    
  • Template with ID = X:
    //element(*, wm:template)[@wm:templateid=1190]
    
  •  Siteworks object with ID = X:
    //element(*)[@wm:id=72430]
    
  • All objecttypes:
    //wm:webmanager//element(*, wm:objecttypeinfo)
    
  • Webpage item with Siteworks name 'Queries':
    //wm:webmanager/wm:websites/wo:webpage_item[@wm:name = 'Queries']
    
  • Webpage item with reference to node Siteworks object of objecttype itemtype and name '370eea2b4dcbba2700212ab636f5':
    wm:webmanager/wm:websites/wo:webpage_item/jcr:deref(@wo:itemtype, '370eea2b4dcbba2700212ab636f5')
    
  • JCR item with UUID '8d38de7b-cec9-4fd6-a714-65e1a61b5bba':
    //*[@jcr:uuid='8d38de7b-cec9-4fd6-a714-65e1a61b5bba']
    
  • All SiteWorks tasks:
    //element(*, wo:wm_taskmanager_task)
    
  • All pages, in descending name order
    //element(*, wo:ss_mastersection) order by @wm:name descending
    
  • All objects for given objecttype
    //element(*)[@jcr:primaryType='wo:personalization_expression']
    
  • All paragraph elements with text 'XX'
    //element(*, wo:ss_element_text ) [@wo:text='XX']
    
  • Find nodes containing a property with value 'XX'
    //* [jcr:contains(@*,'XX')]
    
  • If you wish to find all elements - that use wo:textto save their data (rich text, paragraph, etc.) - containing 'XX'
    //* [jcr:contains(@wo:text,'*XX*')]
    
  • To see a list of WebManager language labels in the edit environment use the following query:
    //element(*, wo:wm_edit_language)
    
  • To see a list of all webinitiatives
    //element(*, 	wo:wm_webinitiatif)
    
  • To see a list of ss_element_external_content where "last X days" > 100 use the following query:
    //element(*, wo:ss_element_external_content) [@wo:lastxdays>100]
    
  • When comparing date properties, use the xs:dateTimefunction. Caution: JackRabbit only accepts a fully specified date, including the time in milliseconds:
    //element(*, wo:wm_content_info)[@wo:lastmodified < xs:dateTime('2008-01-01T00:00:00.000Z')]
    
  • Retrieving the meta data of a media item
    1. Get the exact type of the mediaitem: //wm:components
    2. Hex-code the first number in the media item contentid (e.g. for mediaitem 202209, encode '2' into 0032 via the [http://www.easycalculation.com/ascii-hex.php] site)
    3. Retrieve the meta data using //<exact-type>/allContainerNode/_x<hex>_restofnumber (e.g. //nl.gx.elsevier.elseviermediaitems.AbonneeMediaItemVersionImpl/allContainerNode/_x0032_02209
    
  • Find an link which refers to a page of nu.nl
    //element(*,wo:ss_element_internal_externallink)[jcr:like(@wo:URL,'http://www.nu.nl/%')

 

  • Find pages which have a link that refers to a page of nu.nl
    //element(*,wo:ss_section)[jcr:like(wo:related/wo:URL,'http://www.nu.nl/%')
  • Find pages which have a link that refers to a page of nu.nl
    //element(*,wo:ss_section)[jcr:like(wo:related/wo:URL,'http://www.nu.nl/%')

 

  • Find page versions which have an preload form attribute
    //element(*, wo:ss_section)[@wo:preload_form]
    

*** Please note that Jackrabbit supports a subset of XPath 2.0 which is a subset of XQuery1.0.

Even though Jackrabbit uses the XQuery grammar, it only implements the set of XPath features required by JCR-170 (and some
extras, like predicates on location steps).

For more information about XPath see the documentation and software resources page

  • No labels