Question

I have two complex types declared as(the type SecurityRule is well defined):

<xs:complexType name="SecurityGroup">
    <xs:sequence>
        <xs:element name="rules" type="SecurityRule" maxOccurs="unbounded"></xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>

<xs:complexType name="Template">
    <xs:sequence>
        <xs:element name="tagsList" maxOccurs="unbounded"
            type="xs:string"></xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"></xs:attribute>
    <xs:attribute name="providerId" type="xs:string"></xs:attribute>
    <xs:attribute name="locationName" type="xs:string"></xs:attribute>
</xs:complexType>

Now when I try to use these two complex types in a third complex type like this:

<xs:complexType name="CreateServerInputBean">
        <xs:element name="template" type="Template"></xs:element>
        <xs:element name="securityGroup" type="SecurityGroup"></xs:element>
</xs:complexType>

The error I received is:

s4s-elt-invalid-content.1: The content of 'CreateServerInputBean' is invalid.  Element 'element' is invalid, misplaced, or occurs too often.

Anyone help me to resolve this issue.

Was it helpful?

Solution

Use like this

<xs:complexType name="CreateServerInputBean">
<xs:sequence>
        <xs:element name="template" type="Template"></xs:element>
        <xs:element name="securityGroup" type="SecurityGroup"></xs:element>
    </xs:sequence>
</xs:complexType>

or with <xs:choice> or <xs:all> depending upon your requirement

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top