Another possible implementation is as a layer on top of a file system where that file system contains structured content in the form of XML files.
Let’s say that the file system looks like this:
/
products.xml
people.xml
services.xml
products/
rhombus.xml
...
people/
...
services/
...
And products.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<content>
<title>Our Products</title>
<lead>Geometrixx is proud to offer...</lead>
<paragraph>
<text>Geometrixx is the industry leader...</text>
<image>/9j/4AAQSkZJRgABAQ...</image>
</paragraph>
<paragraph>
<text>We have recently...</text>
<image>/9j/4AAQSkZJRgABAQ...</image>
</paragraph>
</content>
And similarly, rhombus.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<content>
<title>Rhombus: The shape of things to come!</title>
<price>123.00</price>
<lead>Here at Geometrixx...</lead>
<paragraph>
<text>The rhombus is a very special shape...</text>
<image>/9j/4AAQSkZJRgABAQ...</image>
</paragraph>
<paragraph>
<text>Some say a square is...</text>
<image>/9j/4AAQSkZJRgABAQ...</image>
</paragraph>
</content>
One way of mapping this to a content repository would be:
Node
Property = "Some value"
/ |
[root] |
products.xml |
├─products |
[creation date of the file] |
│ ├─jcr:created = "2001-01-01T..." |
<?xml version=”1.0”...?> <content> |
│ ├─jcr:content │ │ │ |
<title>Our Products</title> |
│ │ ├─myapp:title = "Our Products" |
<lead>Geometrixx is...</lead> |
│ │ ├─myapp:lead = "Geometrixx is..." |
<paragraph> |
│ │ ├─myapp:paragraph[1] |
<text>Geometrixx is...</text> |
│ │ │ ├─myapp:text = "Geometrixx is..." |
<image>/9j/4AAQ...</image> |
│ │ │ └─myapp:image = <binary data> |
</paragraph> |
│ │ │ |
<paragraph> |
│ │ └─myapp:paragraph[2] |
<text>We have...</text> |
│ │ ├─myapp:text = "We have..." |
<image>/9j/4AAQ...</image> |
│ │ └─myapp:image = <binary data> |
</paragraph> </content> |
│ │ │ │ |
products/ |
│ │ |
rhombus.xml |
│ ├─rhombus |
[creation date of the file] |
│ │ ├─jcr:created = "2002-06-01T..." |
<?xml version=“1.0“...?> <content> |
│ │ └─jcr:content │ │ │ |
<title>Rhombus:...</title> |
│ │ ├─myapp:title = "Rhombus:..." |
<price>123.00</price> |
│ │ ├─myapp:price = "123.00" |
<lead>Here at...</lead> |
│ │ ├─myapp:lead = "Here at..." |
<paragraph> |
│ │ ├─myapp:paragraph[1] |
<text>The rhombus...</text> |
│ │ │ ├─myapp:text = "The rhombus..." |
<image>/9j/4A...</image> |
│ │ │ └─myapp:image = [binary data] |
</paragraph> |
│ │ │ |
<paragraph> |
│ │ └─myapp:paragraph[2] |
<text>Some say...</text> |
│ │ ├─myapp:text = "Some say..." |
<image>/9j/4A...</image> |
│ │ └─myapp:image = <binary data> |
</paragraph> </content> ... |
│ │ │ │ │ ... |
people.xml |
├─people |
[creation date of the file] |
│ ├─jcr:created = "2001-01-01T..." |
<?xml version=“1.0“...?> <content> ... |
│ ├─jcr:content │ │ │ │ │ ... |
people/ |
│ │ |
fred.xml |
│ ├─fred |
[creation date of the file] |
│ │ ├─jcr:created = "2001-12-01T..." |
<?xml version=“1.0“...?> ... |
│ │ ├─jcr:content ... |
This example demonstrates the use of a fine-grained content model where the mapping to a node-property structure extends from the folder and file level into the internal structure of the XML document.
Note that this example is just one possible mapping; it is not meant to imply that this is the only mapping between the repository and XML (see, for example, 6.4 XML Mappings).