0
votes

Please help to resolve the below error for the XSD as i'm a newbie to xsd

Sample SOAP response XML

 <ACCOUNTDETAILS>
 <STATUS></STATUS>
 <RESPONSE></RESPONSE>
 <ACCOUNTID>
 <DETAILS>
 <NAME></NAME>
 <CATEGORY></CATEGORY>
 <LASTMODIFIED></LASTMODIFIED>
  </DETAILS>
  </ACCOUNTID>
  </ACCOUNTDETAILS>

XSD generated

<xsd:element name="AccountDetailsResponse">
  <xsd:element name="ACCOUNTDETAILS" type="account:Account">
     <xsd:complexType>
       <xsd:sequence>
         <xsd:element type="xsd:string" name="STATUS"/>
         <xsd:element type="xsd:string" name="RESPONSE"/>
         <xsd:element name="ACCOUNTID">
           <xsd:complexType>
             <xsd:sequence>
               <xsd:element name="DETAILS">
                 <xsd:complexType>
                   <xsd:sequence>
                     <xsd:element type="xsd:string" name="NAME"/>
                     <xsd:element type="xsd:string" name="CATEGORY"/>
                     <xsd:element type="xsd:string" name="LASTMODIFIED"/>
                   </xsd:sequence>
                 </xsd:complexType>
               </xsd:element>
             </xsd:sequence>
           </xsd:complexType>
         </xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
  </xsd:element>

XSD ERROR:

s4s-elt-must-match.1: The content of 'AccountDetailsResponse' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: element.

Thanks in advance

1
You can not nest <xsd:element> within <xsd:element> like you do with AccountDetailsResponse and ACCOUNTDETAILS. What would like to do exactely? Define an element type? Use a reference toward another element definition?potame
Can you please provide with a sample ? Thanksuser3492471
Before providing a sample, you should explain what you would like to do exactely, what are your difficulties, and so on. If you require a tutorial, I'm not certain SO is the right place.potame

1 Answers

1
votes

Most likely you did not provided us with the entire input. From your schema, I would expect an element AccountDetailsResponse around the excerpt you posted.

As you figured out for the other elements, you cannot have an xs:element as a direct child of another xs:element. Most likely, using the same as you did for the other elements (an ordered sequence of children) would do what you want:

<xsd:element name="AccountDetailsResponse">
   <xsd:complexType>
      <xsd:sequence>
         <xsd:element name="ACCOUNTDETAILS" type="account:Account">
         ...

This will not work either, as you cannot have both a type attribute, and an embedded xs:complexType at the same time. So probably you will want to get rid of that one type attribute. So the following should work:

<xsd:element name="AccountDetailsResponse">
   <xsd:complexType>
      <xsd:sequence>
         <xsd:element name="ACCOUNTDETAILS">
         ...