Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array of string in XSD

Tags:

xml

xsd

Hello I need to show the array of strings in XSD. I've tried this, Can any one help me write it correctly. Thanks.

What it prints

<numbers>13 32 23</numbers>

Current XSD

<xs:element name="numbers" minOccurs="0" maxOccurs="1"> 
    <xs:simpleType>
          <xs:list itemType="xs:string">                                                     

          </xs:list>
    </xs:simpleType>

What I need is below.

<numbers>
   <number>13</number><number>32</number>
</numbers>
like image 232
Zeus Avatar asked Sep 05 '25 03:09

Zeus


1 Answers

The question is resolved since Petru's answer is correct. I just want to add some additional information I found related with this same topic about how to define array types, optional and mandatory:

Primitive types

 <xsd:element name="A"/>

means A is required and must appear exactly once.

<xsd:element name="A" minOccurs="0"/>

means A is optional and may appear at most once.

Arrays/Lists

<xsd:element name="A" maxOccurs="unbounded"/>

means A is required and may repeat an unlimited number of times

<xsd:element name="A" minOccurs="0" maxOccurs="unbounded"/>

means A is optional and may repeat an unlimited number of times

like image 113
Ignacio Alorre Avatar answered Sep 07 '25 19:09

Ignacio Alorre