对sql2查询的相同Xpath查询?

时间:2015-06-25 13:12:46

标签: xpath cq5 jcr-sql2

我想要相同的XPATH查询来实现SQL2查询。

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/abc/def]) and ([sling:resourceType] = 'geomatrixx/components/list' )

是否有任何可用的工具或链接可以将sql2查询转换为xpath。或任何教程,如果是,那么请分享链接

1 个答案:

答案 0 :(得分:2)

以下是等价的XPath查询。

    /jcr:root/content/abc/def//element(*, cq:Page)[jcr:contains(jcr:content/@sling:resourceType, 'geometrixx/components/list')].

以下是 xpath sql2 查询之间的一些映射。来自http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html

      //*                                                SELECT * FROM [nt:base]
      //element(*,my:type)                               SELECT * FROM [my:type]
     //element(*,my:type)/@my:title                      SELECT [my:title] FROM [my:type]
     //element(*,my:type)/(@my:title | @my:text)         SELECT [my:title],[my:text] FROM [my:type]
    //element(*,my:type)/(@my:title union @my:text)      SELECT [my:title],[my:text] FROM [my:type]

谢谢, 巴拉吉