Expand my Community achievements bar.

SOLVED

How to control the order of sibling nodes in JCR packages?

Avatar

Level 1

Hi,

I'm moving content from a legacy CMS to AEM using JCR packages. My .content.xml, by way of example, looks like this:

... </jcr:content><Android/><BlackBerry/><Chrome/><Doc Finder/><HTML5/><iOS/><Java/><Linux/><Mac/><Mobility Pack/><Offline Plug-in/><Online Plug-in/><Playbook/><Windows/><Windows 8/RT/><Windows CE/><Windows Phone 8/><Updater for Windows/></jcr:root>

The order of the subfolder siblings (<Java/><Linux/><Mac/> etc.), when the packages are imported to AEM, seems randomly changed. I know that the order of the files in the JCR zip is different, as I write the files to a directory structure on disk before I zip them up.

I guess my question is, how does AEM determine the order of the sibling nodes when a package is imported? I'm kinda tearing my hair out here, so would certainly appreciate any idea sharing!

 

Cheers,

Gordon

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Gordon,

The support for same name siblings in Oak is deprecated. See [1]. I would recommend to create unique names for nodes beneath a common parent node.

kind regards,
Jörg

[1] http://jackrabbit.apache.org/oak/docs/differences.html

View solution in original post

4 Replies

Avatar

Correct answer by
Employee Advisor

Hi Gordon,

The support for same name siblings in Oak is deprecated. See [1]. I would recommend to create unique names for nodes beneath a common parent node.

kind regards,
Jörg

[1] http://jackrabbit.apache.org/oak/docs/differences.html

Avatar

Employee

Hi Gordon,

What is the jcr:primaryType of the jcr:root element?

For nodes to be ordered in a consistent fashion, you need to use a node type which has orderable child nodes. Examples include nt:unstructured, sling:OrderedFolder, and cq:Page. 

Please post the full .content.xml file (preferably using the code formatting so that it doesn't all get lumped onto a single line).

Regards,

Justin

Avatar

Level 1

Hi Justin, thank you! Here is a sample .content.xml - I normally use the jcr:primaryType:cg:ContentPage, I was experimenting here to use cq:Page.

<?xml version="1.0" ?> <jcr:root jcr:primaryType="cq:Page" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"> <jcr:content cq:lastModified="{Date}2014-11-12T15:28:26.216Z" cq:lastModifiedBy="admin" cq:template="/apps/xxxxedocs/templates/content" jcr:isCheckedOut="{Boolean}true" jcr:mixinTypes="[mix:versionable]" jcr:primaryType="cq:Page" jcr:title="xxxx Receiver" jcr:uuid="feaa6f06-a4d9-4428-844c-c1969e0c9808" navTitle="" pageTitle="" sling:resourceType="xxxxedocs/components/page/contentpage"> <par jcr:primaryType="nt:unstructured" sling:resourceType="foundation/components/parsys"> <richtext jcr:created="{Date}2014-06-12T12:43:30.918-04:00" jcr:createdBy="admin" jcr:lastModified="{Date}2014-06-12T12:45:26.449-04:00" jcr:lastModifiedBy="admin" jcr:primaryType="nt:unstructured" sling:resourceType="xxxxedocs/components/section/richtext" text="xxxx" textIsRich="true"/> <richtext_0 jcr:created="{Date}2014-06-12T12:43:30.918-04:00" jcr:createdBy="admin" jcr:lastModified="{Date}2014-06-12T12:45:26.449-04:00" jcr:lastModifiedBy="admin" jcr:primaryType="nt:unstructured" sling:resourceType="xxxxedocs/components/section/richtext" text="xxxx" textIsRich="true"/> <richtext_1 jcr:created="{Date}2014-06-12T12:43:30.918-04:00" jcr:createdBy="admin" jcr:lastModified="{Date}2014-06-12T12:45:26.449-04:00" jcr:lastModifiedBy="admin" jcr:primaryType="nt:unstructured" sling:resourceType="xxxxedocs/components/section/richtext" text="xxxxx" textIsRich="true"/> <richtext_2 jcr:created="{Date}2014-06-12T12:43:30.918-04:00" jcr:createdBy="admin" jcr:lastModified="{Date}2014-06-12T12:45:26.449-04:00" jcr:lastModifiedBy="admin" jcr:primaryType="nt:unstructured" sling:resourceType="xxxxedocs/components/section/richtext" text="xxxxx" textIsRich="true"/> </par> </jcr:content> <receivers-android/> <blackberry-receiver-22-admin-wrapper/> <receivers-chrome-os/> <receivers-html5/> <receivers-ios/> <receivers-java-landing-page-version-101/> <receivers-linux-wrapper/> <receivers-mac-wrapper/> <mobility-pack-wrapper/> <receivers-offline-plugin-wrapper/> <online-plugin-wrapper/> <playbook-receiver-wrapper/> <rec-receiver-for-win/> <rec-8rt-14-wrapper/> <wince-wbt-receiver1102-wrapper/> <rec-winphone8-wrapper/> <rec-receiver-updater-windows/> </jcr:root>