cq5 - How to access jcr:root with XPath JCR Query -


I would like to apply some Java function to CQ5 dialog . In the first step, I search for Dialog XML files in the myComponent folder :

  NodeEaterator tabrequirefield = getQueryResult ("/ jcr: root / apps / myProject / pages / MyComponent / dialog / jcr: root ")   

But this query does not supply any results. The CRX Expedial tool does not display any results, it also sees anecdotal picture:

 Enter an image description here

My / jcr: root / apps / myProject / pages / myComponent / dialog.xml looks like this:

  & lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; Jcr: root xmlns: cq = "http://www.day.com/jcr/cq/1.0" xmlns: jcr = "http://www.jcp.org/jcr/1.0" xmlns: nt = "http: //www.jcp.org/jcr/nt/1.0 "JCR: Primary Type =" CC: Dialog "Stateful =" Fotal "title =" Test "..... & gt; & Lt; Item JCR: Primary Type = "cq: Widget" xtype = "Panel" & gt; ... ...... & lt; / Items & gt; ..... & lt; / Jcr: root & gt;   

I can follow items

  nodeitor tabRequiredFields = getQueryResult ("/ jcr: root / apps / myProject / Pages / MyComponent / dialog / items ")   

This works fine, my question is: why jcr: root ? XML element named code> JCR: Route to

does not create jcr: root node in the repository. This is a special, reserved identifier, and the CRX Package Manager keeps all the elements and sub-nodes of this element in the node, which is similar to the name without an extension (in your case this will be the dialogue ).

If it is not clear, then use CRX Day, open / apps / myProject / pages / myComponent and see what you can find there. This is why you should add / dialog instead of / jcr: root at the end of your path.

If you want to find all the dialogs, then use the primary type cq: dialog , as Rakhi 4110 suggests. The following query:

  / jcr: root / apps / myProject / pages // element (*, cq: dialog)   

All the dialogues / Apps / myProject / pages (and lineage).

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -