[opencms-dev] small issue with defaults in .xsd
Fabian Huschka
fabian.huschka at componio.net
Thu Apr 10 14:51:06 CEST 2008
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: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080410/8574ccc0/attachment.htm>
More information about the opencms-dev
mailing list