Hi Mark and list,


I'm not sure if this is a XML::Compile question or just proof that I need 
training on XML.



I have a schema that contains a section like this:



<xs:element minOccurs="0" name="contents">

<xs:complexType>

<xs:sequence>

<xs:element maxOccurs="unbounded" minOccurs="0" name="component">

<xs:complexType>

<xs:choice>

<xs:element minOccurs="0" name="csRef">

<xs:annotation>

<xs:documentation>This element can be used to referenced when the content is 
already

stored in a content repository.

In the case of uploading the content, it must not be present.

</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:element name="csId" type="csIdType"/>

<xs:element name="contentId" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>





In perl I build a structure like this:



                               contents => {

                                               component => [

                                                               {

                                                                              
csRef => { csId => 'fld', contentId => 'docid', },

                                                                              
title => 'PerlTest',

                                                                              
mimeType => 'text/plain',

                                                                              
fileExtension => 'txt',

                                                                              
lang => 'fr',

                                                               },

                                               ],





The above fragment will be converted to XML by XML::Compile::Schema. However if 
I don't specify the csRef, it refuses to convert to XML, and gives me the error



error: no match for required block `cho_csRef' at node/contents/component



The schema does say   minOccurs="0", so I don't know why I have to provide it.

However the xs:choice does seem required, so I understand the error.

Is the schema just bad ?



Thanks for any pointers,



Ciaran Deignan

RSD Technical Support


_______________________________________________
Xml-compile mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile

Reply via email to