[opencms-dev] Fwd: Issue with default values in the content type
Antonio Cordeddu
antoniocordeddu at coranto.it
Mon Jul 20 10:23:57 CEST 2015
Hi Ashish,
I tested and it works on OpenCms 9.5.2. So, please copy and paste, it
should be run also for you.
*OceanSchm.xsd:*
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:include
schemaLocation="opencms://system/modules/my.template/schemas/nested/address.xsd"/>
<xsd:element name="OceanSchms" type="OpenCmsOceanSchms"/>
<xsd:complexType name="OpenCmsOceanSchms">
<xsd:sequence>
<xsd:element name="OceanSchm" type="OpenCmsOceanSchm"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsOceanSchm">
<xsd:sequence>
<xsd:element name="MainContent" type="OpenCmsAddress"
minOccurs="1" maxOccurs="10" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale"
use="required"/>
</xsd:complexType>
<xsd:annotation>
<xsd:appinfo>
<mappings>
<mapping element="MainContent/Title"
mapto="property:Title" />
<mapping element="MainContent/Title" mapto="urlName" />
</mappings>
<defaults>
<default element="MainContent/Title" value="Add a new
title here" />
<default element="MainContent/Text" value="Add your
text" />
</defaults>
<searchsettings containerPageOnly="true"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
*nested/address.xsd**:*
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="Addresss" type="OpenCmsAddresss"/>
<xsd:complexType name="OpenCmsAddresss">
<xsd:sequence>
<xsd:element name="Address" type="OpenCmsAddress"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsAddress">
<xsd:sequence>
<xsd:element name="Title" type="OpenCmsString" />
<xsd:element name="Text" type="OpenCmsHtml" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale"
use="optional"/>
</xsd:complexType>
<xsd:annotation>
<xsd:appinfo>
<layouts>
<layout element="Text" widget="HtmlWidget"
configuration="height:400px,link,anchor,source,downloadgallery,formatselect"
/>
</layouts>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Kind regards
Antonio Cordeddu
_______________________________________________
Coranto informatica di Antonio Cordeddu
Via Torricelli, 9 09047 Selargius (CA) - Italy
Phone: +39 070 8607521
Fax: +39 070 8607521
Mobile: +39 328 7552662
antoniocordeddu at coranto.it
Skype: antonio.cordeddu
http://www.coranto.it
___________________________________________
On 16/07/2015 13:57, Ashish Shekhar wrote:
> Hi Kai,
>
> I have removed the default definition from the nested xsd and defined
> the defaults only in main xsd(abc.xsd) but still its not coming.
>
> Any idea?
>
> Thanks
> Ashish
>
> On Wed, Jul 15, 2015 at 6:35 PM, Schliemann, Kai
> <K.Schliemann at comundus.com <mailto:K.Schliemann at comundus.com>> wrote:
>
> Hi,
>
> did you remove the defaults definition from your nested xsd
> (address.xsd) when you defined the defaults in your main xsd
> (abc.xsd)?
>
> HTH
>
> Best regards
>
> Kai
>
> *Von:*opencms-dev-bounces at opencms.org
> <mailto:opencms-dev-bounces at opencms.org>
> [mailto:opencms-dev-bounces at opencms.org
> <mailto:opencms-dev-bounces at opencms.org>] *Im Auftrag von *Ashish
> Shekhar
> *Gesendet:* Mittwoch, 15. Juli 2015 14:49
> *An:* The OpenCms mailing list
> *Betreff:* [opencms-dev] Fwd: Issue with default values in the
> content type
>
> Hi.
>
> Does anyone have idea how to set the default value for nested
> content type? I tried all the approaches suggested but doesn't
> make any difference.
>
> -Ashish
>
> ---------- Forwarded message ----------
> From: *Ashish Shekhar* <ashish.shekharcsc at gmail.com
> <mailto:ashish.shekharcsc at gmail.com>>
> Date: Mon, Jul 13, 2015 at 2:57 PM
> Subject: Issue with default values in the content type
> To: The OpenCms mailing list <opencms-dev at opencms.org
> <mailto:opencms-dev at opencms.org>>
>
> Hi,
>
> I have created content type for which I have configure xsd as per
> my need.
>
> The default value which is coming fine for simple xml content type
> but when I used nested content type the default value is not coming.
>
> I want the default value should come to every nested items when
> ever I add new instance + but its not coming to a single instance.
>
> I am attaching my xsd. Does anyone have idea what is missing here?
>
> Thanks
>
> Ashish
>
>
> _______________________________________________
> 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/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
>
>
>
> _______________________________________________
> 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/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
____
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20150720/5293475a/attachment.htm>
More information about the opencms-dev
mailing list