[opencms-dev] XMLCONTENT - enforcing uniqueness...

Ashok Hariharan ashok.hariharan at gmail.com
Tue Jan 17 09:28:20 CET 2006


Hi:

I am trying to enforce a uniqueness constraint within my xmlcontent XSD in
opencms :

....
    <xsd:complexType name="OpenCmsComesCurrencyRate">
        <xsd:all>
            <xsd:element name="Currency" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencyUSDRate" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencyBuyingRate" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencySellingRate" type="OpenCmsString"
minOccurs="1"/>
        </xsd:all>
        <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
    </xsd:complexType>
.....

This section appears as nested xmlcontent, and can be repeated multiple
times within the parent xml content....

"Currency" is a selector which allows the user to pick a currency type.
However, i would like to enforce a constraint, that prevents
the user from repeating the same currency if it has already been
selected....

i tried adding a xsd:unique constraint (as shown below...), but opencms
doesnt seems to recognise it , and i get marshalling xml errors....

    <xsd:complexType name="OpenCmsComesCurrencyRate">
        <xsd:all>
            <xsd:element name="Currency" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencyUSDRate" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencyBuyingRate" type="OpenCmsString"
minOccurs="1"/>
            <xsd:element name="CurrencySellingRate" type="OpenCmsString"
minOccurs="1"/>
        </xsd:all>
        <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
        <xsd:unique name="Currency">
              <xsd:selector xpath="....." />
               ...........
       </xsd:unique>
    </xsd:complexType>


Does OpenCMS support xsd unique constraints? Is there any other way to
enforce uniqueness within opencms?

thanks

Ashok

--
++++ Ashok Hariharan ++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060117/4833b158/attachment.htm>


More information about the opencms-dev mailing list