Home > Software design >  Error does not compile xml by <xsd:simpleType> tag
Error does not compile xml by <xsd:simpleType> tag

Time:11-11

I try to add a new list to my xml to generate some classes for a service, but when I add this xml fragment it gives me an error in the tags that are inside xsd:sequence all xsd:simpleType. This is the error message that tells me:

s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: simpleType.

And this is how I have built the xml snippet built

   <xsd:complexType name="RegisterEventsSubRequestType">
      <xsd:sequence>
         <xsd:element name="Canal" type="xsd:integer"></xsd:element>
         <xsd:element name="Ean13" type="xsd:integer"></xsd:element>
         <xsd:simpleType>
               <xsd:restriction base="xsd:integer">
                  <xsd:totalDigits value="13"/>
               </xsd:restriction>
         </xsd:simpleType>
         <xsd:element name="Center" type="xsd:integer"></xsd:element>
         <xsd:simpleType>
               <xsd:restriction base="xsd:integer">
                  <xsd:totalDigits value="4"/>
               </xsd:restriction>
         </xsd:simpleType>
         <xsd:element name="Date" type="xsd:dateTime"></xsd:element>
         <xsd:element name="SubColectives" type="tns:SubColectivesType"/>
      </xsd:sequence>
   </xsd:complexType> 

What is the error due to? How could I solve it? I thought that adding a name attribute would solve it, but it hasn't let me.

CodePudding user response:

A sequence cannot contain a loose simpleType declaration.

You probably meant to write

  <xsd:complexType name="RegisterEventsSubRequestType">
     <xsd:sequence>
        <xsd:element name="Canal" type="xsd:integer"></xsd:element>
        <xsd:element name="Ean13">
           <xsd:simpleType>
                 <xsd:restriction base="xsd:integer">
                    <xsd:totalDigits value="13"/>
                 </xsd:restriction>
           </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Center">
            <xsd:simpleType>
                  <xsd:restriction base="xsd:integer">
                     <xsd:totalDigits value="4"/>
                  </xsd:restriction>
            </xsd:simpleType>
        </xsd:element>
        <xsd:element name="Date" type="xsd:dateTime"></xsd:element>
        <xsd:element name="SubColectives" type="tns:SubColectivesType"/>
     </xsd:sequence>
  </xsd:complexType> 
  • Related