[opencms-dev] retreiving content resources by property(secondtime)
Andreas Zahner
A.Zahner at alkacon.com
Thu Jan 19 10:20:06 CET 2006
Osama,
the XML content already supports the feature of mapping element values on
properties or VFS file attributes. In the annotation section of your XSD, do
the following to achieve this (the example below is taken from the
templateone modules):
<xsd:annotation>
<xsd:appinfo>
...
<mappings>
<mapping element="Title" mapto="property:Title" />
<mapping element="Release" mapto="attribute:datereleased" />
<mapping element="Priority"
mapto="property:collector.priority" />
...
<mapping element="Channel"
mapto="propertyList:collector.channel" />
</mappings>
...
</xsd:appinfo>
</xsd:annotation>
A special mapping is the "propertyLis"t mapping, which maps the values of an
element with multiple occcurences to a single property as a List represented
by a String using a delimiter.
Regards,
Andreas Zahner
Alkacon Software - The OpenCms Experts
http://www.alkacon.com
-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Osama Abu Elsorour
Sent: Thursday, January 19, 2006 10:06 AM
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] retreiving content resources by
property(secondtime)
Thank you guys for your suggestions.
Andreas:
I have looked at your proposition and it seems feasible enough to use.
However, I would like to propose the following:
The Problems:
- This method looks on one property with a specific property with a specific
value. If I want to do a bit more complex lookups it will not help.
- Properties will have to be entered separately. Meaning that after the
editor fills his XML content form, he/she will have to edit the file
properties and add/edit the properties that will be used in the lookups.
Major inconvenience.
So I thought of doing the following (actually kinda started on it too):
- Build a custom XML type, call it XmlPropertyType for example
- It represents a string, very similar to XmlString
- It will also reflect any changes to it to a property with the same name
For example, if we add a form field called "Author" with type
XmlPropertyType, it will be saved normally in the XML file as a normal
string and in the same time will update a property called "Author" as well.
This way "Author" can be used in ContentShow and can be queried as property
without doing double the data entry work.
I know this might seem as an ugly redundancy in storage, but hear me out.
More information about the opencms-dev
mailing list