2015-06-25 97 views
0

我想要相同的XPATH查詢trhis SQL2查詢。相同的Xpath查詢到sql2查詢?

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

是否有任何工具或鏈接可用,通過它我可以將sql2查詢轉換爲xpath。或任何教程如果是的話請分享鏈接

+2

我所知道的唯一方法是使用代碼。如果使用com.day.cq.search.Query類,則會在調用方法getResult()後在IDE的調試器中看到使用的xpath查詢... – Thomas

回答

2

下面是等價的XPath查詢。

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

下面是一些映射從http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html respectively.Taken之間的XPath SQL2查詢。

 //*            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] 

感謝, 巴拉吉