Page tree
Skip to end of metadata
Go to start of metadata


The "jcr system view" xml format is difficult to work with in typical team source control cases, such as diffing and merging.
The xml format is hard to read and perform manual edits on which is not an uncommon task in project development.  MAGNOLIA-6683 - Getting issue details... STATUS .

JCR document view

Mikaël Geljić: JCR specifies the Document View, specifically providing a human-readable serialization. This should be fairly easy to work with, diff/merge.

This format is legit bootstrap and works in Magnolia / Jackrabbit out of the box.


(plus) works out of the box

(plus) better diff

(minus) still XML with meta information (can be omitted/filtered out?)


(plus) same format for light development 

(plus) nice diff

(plus)/(minus) no meta information, easy to read (but this should not be a replacement for XML bootstrap files, just an easy to alternative, right?)

What do we need?


Node → Raw view → YAML (tick)

  1. allow to export non registry items as YAML
  2. implement helper for importing yaml content into a workspace
    • slightly custom n2b transformer (OR a custom node wrapper?) due to the node type information (JCR properties are filtered out by default)
      • nodeName(mgnl:page) vs nodeName/jcrNodeType=mgnlPage


YAML → Reader → Map → create the content via Node API (tick)
(lightbulb) Performance? Do we care or it's only for "light" content?



  • N2B Transformer specifies getChildren() method but filtering of properties is hardcoded. We need at least jcr:primaryType and jcr:uuid for export (and we probably want to support all of those). A solution is to introduce N2BTransformer.getProperties() in the same fashion as getChildren().


  • Components 0 and 00
    • YAML reader considers both '0' and '00' as number 0
    • Resulting in only one of those nodes added

    • Solution: enclose non simple propeties into apostrophes: 
    • Resulting in only one of those nodes added

         hideTeaserImage: true
         headline: 'Careers'

  • Data types


  • Overrides impl of import and download as YAML commands.
  • Location?
    • It's using tools from magnolia-configuration but it's not about a content a configuration anymore
        1. Still place it to magnolia-configuration
        2. content-importer

jcr:name: page
Binary: !!binary QmluYXJ5
Date: 2017-03-09T10:27:58.617+01
Double: 1.0
Name: !Name 'mgnl:contentNode'
Path: !Path '/page'
Reference: !Reference 'cafebabe-cafe-babe-cafe-babecafebabe'
URI: !URI '/page'
WeakReference: !WeakReference 'cafebabe-cafe-babe-cafe-babecafebabe'
jcr:primaryType: !Name 'mgnl:contentNode'
jcr:uuid: '76207274-03f9-4aca-b587-5cfc2ecd1763'
mgnl:created: 2017-03-09T10:27:58.615+01
mgnl:createdBy: 'anonymous'
mgnl:lastModified: 2017-03-09T10:27:58.615+01
mgnl:lastModifiedBy: 'anonymous'
propertyName: 'propertyValue'
  jcr:primaryType: !Name 'mgnl:content'
  jcr:uuid: '20cfdb2b-fb33-45f2-b5e4-d8d90455d938'
  mgnl:created: 2017-03-09T10:27:58.619+01
  mgnl:createdBy: 'anonymous'
  mgnl:lastModified: 2017-03-09T10:27:58.619+01
  mgnl:lastModifiedBy: 'anonymous'
  childProperty: ['child:PropertyValue1', 'childPropertyValue2']
  jcr:primaryType: !Name 'mgnl:content'
  jcr:uuid: '1a481550-e2f8-402f-8d15-044c5157a598'
  mgnl:created: 2017-03-09T10:27:58.620+01
  mgnl:createdBy: 'anonymous'
  mgnl:lastModified: 2017-03-09T10:27:58.620+01
  mgnl:lastModifiedBy: 'anonymous'

  • No labels


  1. An advantage of YAML is that it is very comfortable for developers to work with. 

  2. JSON is also valid YAML. Developers very often work with content or mock content in json files. Does the implementation researched also accept JSON? This would be great.

  3. Document view does not support multi values.

    Once upon a time, I wrote a document regarding that.

    1. Thanks for the input. We decided to continue with the YAML format.