[opencms-dev] XSD contents : minOccurs maxOccurs problems

TechnoSophos technosophos at gmail.com
Tue May 6 16:08:58 CEST 2008


Change the language xsd:attribute:

<xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>

(The important thing is use="optional")

For a very good example, look at the article.schema and
paragraph.schema files in the templatetwo.demo project.


Matt

On Tue, May 6, 2008 at 7:51 AM, Territorio Jordan-V.
<jordan.territorio at gmail.com> wrote:
> Finally it seems the good way is that...
>
> <xsd:complexType name="OpenCmsMyNewsList">
>         <xsd:sequence>
>             <xsd:element name="AntargazNew" type="OpenCmsAntargazNew"
>                  minOccurs="0" maxOccurs="unbounded" />
>         </xsd:sequence>
>         <xsd:attribute name="language" type="OpenCmsLocale"
>             use="required" />
>      </xsd:complexType>
>
>  but i still have this error with the language when i edit a new structured
> content "NewsList" and i really don't know what to do ...
> The editor appeared with the possibility to add a new block, but when i push
> the button "add new" an exception is throwed :
>  <errors>
> <error column="18" line="5">cvc-complex-type.4: Attribute 'language' must
> appear on element 'AntargazNew'.</error>
>
>
> </errors>
>
>
> 2008/5/6 Territorio Jordan-V. <jordan.territorio at gmail.com>:
> > For the newslist.xsd i've tried this too :
> >
> >
> > <xsd:element name="MyNewsLists" type="OpenCmsMyNewsLists" />
> >
> >     <xsd:complexType name="OpenCmsMyNewsLists">
> >         <xsd:sequence>
> >             <xsd:element name="MyNewsList" type="OpenCmsMyNewsList"
> minOccurs="0" maxOccurs="unbounded" />
> >         </xsd:sequence>
> >     </xsd:complexType>
> >
> >     <xsd:complexType name="OpenCmsMyNewsList">
> >         <xsd:sequence>
> >             <xsd:element name="AntargazNew" type="OpenCmsAntargazNew"/>
> >
> >         </xsd:sequence>
> >         <xsd:attribute name="language" type="OpenCmsLocale"
> >             use="required" />
> >     </xsd:complexType>
> >
> >
> > But i obtained :
> > XML validation error :
> > <errors>
> > <error column="30" line="4">cvc-complex-type.2.4.b: The content of element
> 'MyNewsList' is not complete. One of '{AntargazNew}' is expected.</error>
> > </errors>
> >
> >
> >
> > 2008/5/6 Territorio Jordan-V. <jordan.territorio at gmail.com>:
> >
> >
> >
> >
> > > It's hard to know when remove when keep... but i still have the error.
> :'(
> > > That's great we have noticed 5 ways for "how to not make a correct list
> of some complex type with opencms"...
> > >
> > > fu.... CMS !!!! lol
> > >
> > > for the moment that's what i have with your correction :
> > >
> > > antargaz_news.xsd
> > > <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" />
> > >     <xsd:element name="AntargazNews" type="OpenCmsAntargazNews" />
> > >
> > >     <xsd:complexType name="OpenCmsAntargazNews">
> > >         <xsd:sequence>
> > >             <xsd:element name="AntargazNew" type="OpenCmsAntargazNew"
> > >                 minOccurs="0" maxOccurs="unbounded" />
> > >         </xsd:sequence>
> > >     </xsd:complexType>
> > >
> > >     <xsd:complexType name="OpenCmsAntargazNew">
> > >         <xsd:sequence>
> > >
> > >             <xsd:element name="Title" type="OpenCmsString" />
> > >             <xsd:element name="Image" type="OpenCmsVfsFile"
> > >                 minOccurs="0" maxOccurs="1" />
> > >             <xsd:element name="Text" type="OpenCmsHtml" minOccurs="0"
> maxOccurs="unbounded"/>
> > >             <xsd:element name="Image" type="OpenCmsVfsFile"
> > >                 minOccurs="0" maxOccurs="1" />
> > >         </xsd:sequence>
> > >         <xsd:attribute name="language" type="OpenCmsLocale"
> > >             use="required" />
> > >     </xsd:complexType>
> > > ...
> > >
> > > antargaz_newslist.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/org.antargaz.modules.first/schemas/antargaz_news.xsd"
> />
> > >
> > >     <xsd:element name="MyNewsLists" type="OpenCmsMyNewsLists" />
> > >
> > >     <xsd:complexType name="OpenCmsMyNewsLists">
> > >         <xsd:sequence>
> > >             <xsd:element name="MyNewsList" type="OpenCmsMyNewsList"
> > >                 minOccurs="0" maxOccurs="unbounded" />
> > >         </xsd:sequence>
> > >     </xsd:complexType>
> > >
> > >     <xsd:complexType name="OpenCmsMyNewsList">
> > >         <xsd:sequence minOccurs="0" maxOccurs="unbounded">
> > >             <xsd:element name="OpenCmsAntargazNew"
> type="OpenCmsAntargazNew"/>
> > >
> > >         </xsd:sequence>
> > >         <xsd:attribute name="language" type="OpenCmsLocale"
> > >             use="required" />
> > >     </xsd:complexType>
> > > </xsd:schema>
> > >
> > >
> >
> >
> >
> >
> >
> >
> > --
> > TERRITORIO Jordan-Victor
> > Ingénieur d'Intégration Java
> > TEAMLOG – Ingenieurs 2000
> >
> > +33 6 30 66 54 69
> > jot at teamlog.com
>
>
>
> --
> TERRITORIO Jordan-Victor
> Ingénieur d'Intégration Java
> TEAMLOG – Ingenieurs 2000
>
> +33 6 30 66 54 69
> jot at teamlog.com
>
>  _______________________________________________
>  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
>



More information about the opencms-dev mailing list