[opencms-dev] Default value for nested .xsd
Fabian Huschka
fabian.huschka at componio.net
Mon Apr 14 11:07:21 CEST 2008
Hello Stéphane,
never tried that approach. Good to know.
However when you have a complex nested content structure it is easier to
maintain default values, mappings and so on in a single place.
\Fabian
Stéphane Martin schrieb:
> Dear Fabian,
>
> thanks a lot for your help. Meanwhile I have found another solution. I have
> included the default values directly in the nested contact, i.e.:
>
> <xsd:complexType name="OpenCmsBBNewsContact">
> <xsd:sequence>
> <xsd:element name="ContactCompany"
> type="OpenCmsString" default="abc" />
> <xsd:element name="ContactName" type="OpenCmsString"
> default="def" />
> </xsd:sequence>
> <xsd:attribute name="language" type="OpenCmsLocale"
> use="optional" />
> </xsd:complexType>
>
> Best regards and thank you for your help.
>
> Stéphane
>
> Message: 4
> Date: Thu, 10 Apr 2008 14:51:06 +0200
> From: Fabian Huschka <fabian.huschka at componio.net>
> Subject: Re: [opencms-dev] small issue with defaults in .xsd
> To: The OpenCms mailing list <opencms-dev at opencms.org>
> Message-ID: <47FE0D3A.2010301 at componio.net>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello,
>
> you have to define the default values within the most outer schema (the one
> which is called to create the resource).
> Further you have to specify the full path to pick the right node.
>
> For example foo.xsd is nested within bar.xsd by the element name of
> SomeElement. Further foo.xsd contains the element AnotherElement. In case
> you want to set a default value for all AnotherElement(s) you have to add
> the following to *bar.xsd*.
>
> <defaults>
> <default element="SomeElement/AnotherElement" value="abc"/>
> </defaults>
>
>
> If you have more than one element you can state explicitly which element you
> want to address by appending [# >=1 (index of element)] to the path.
> Example picks the second SomeElement and the fifth AnotherElement. In case
> these elements do no not exist no error is thrown.
>
> <defaults>
> <default element="SomeElement[2]/AnotherElement[5]" value="abc"/>
> </defaults>
>
>
> This works with multi-layer nested schemas too - only the path becomes
> longer and longer ;-).
>
>
> \Fabian
>
>
> St?phane Martin schrieb:
>
>> Dear Fabian,
>>
>> yes exactly. It is nested in another .xsd.
>>
>> Best regards
>>
>> Stephane
>>
>> Message: 10
>> Date: Wed, 09 Apr 2008 19:53:15 +0200
>> From: Fabian Huschka <fabian.huschka at componio.net>
>> Subject: Re: [opencms-dev] small issue with defaults in .xsd
>> To: The OpenCms mailing list <opencms-dev at opencms.org>
>> Message-ID: <47FD028B.3000403 at componio.net>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Hello Stephane,
>>
>> is this xsd nested in another xsd?
>>
>> Regards,
>>
>> \Fabian
>>
>> Stephane Martin schrieb:
>>
>>
>>> Dear list members,
>>>
>>> this is a part of my .xsd:
>>>
>>> <xsd:annotation>
>>> <xsd:appinfo>
>>> <preview uri="${previewtempfile}" />
>>> <resourcebundle name="de.xx.de.xy.workplace"/>
>>> <mappings>
>>> <mapping element="ContactCompany"
>>> mapto="property:ContactCompany" />
>>> <mapping element="ContactName"
>>> mapto="property:ContactName" />
>>> <mapping element="ContactDepartment"
>>> mapto="property:ContactDepartment" />
>>> </mappings>
>>> <defaults>
>>> <default element="ContactCompany"
>>> value="abc"/>
>>> <default element="ContactName" value="def"/>
>>> <default element="ContactDepartment"
>>> value="ghi"/>
>>> </defaults>
>>> </xsd:appinfo>
>>> </xsd:annotation>
>>>
>>> The values set for the elements with <default do no appear when
>>> editing or creating new content articles based on this .xsd. Can
>>> someone explain why the values are not set?
>>>
>>> Best regards
>>>
>>> Stephane
>>>
>>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list To change
>> your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.opencms.org/pipermail/opencms-dev/attachments/20080410/8574ccc0
> /attachment-0001.htm
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080414/66e6e90e/attachment.htm>
More information about the opencms-dev
mailing list