So, I have a .xsd file that has a lot of repetitions in it.
<xs:complexType name="Square">
<xs:sequence>
<xs:element name="Side1" type="xs:integer" minOccurs="1"/>
<xs:element name="Side2" type="xs:integer" minOccurs="1"/>
<xs:element name="Side3" type="xs:integer" minOccurs="1"/>
<xs:element name="Side4" type="xs:integer" minOccurs="1"/>
</xs:sequence>
<xs:attribute name="squarename" type="xs:string" use="optional" />
<xs:attribute name="squarenumber" type="xs:integer" use="optional" />
</xs:complexType>
<xs:complexType name="Rectangle">
<xs:sequence>
<xs:element name="Side1" type="xs:integer" minOccurs="1"/>
<xs:element name="Side2" type="xs:integer" minOccurs="1"/>
<xs:element name="Side3" type="xs:integer" minOccurs="1"/>
<xs:element name="Side4" type="xs:integer" minOccurs="1"/>
</xs:sequence>
<xs:attribute name="rectanglecolor" type="xs:string" use="optional" />
<xs:attribute name="rectanglelabel" type="xs:string" use="optional" />
</xs:complexType>
<xs:complexType name="Rhombus">
<xs:sequence>
<xs:element name="Side1" type="xs:integer" minOccurs="1"/>
<xs:element name="Side2" type="xs:integer" minOccurs="1"/>
<xs:element name="Side3" type="xs:integer" minOccurs="1"/>
<xs:element name="Side4" type="xs:integer" minOccurs="1"/>
</xs:sequence>
<xs:attribute name="rhombosdance" type="xs:string" use="optional" />
<xs:attribute name="rhombusname" type="xs:string" use="optional" />
</xs:complexType>
Note that
<xs:sequence>
<xs:element name="Side1" type="xs:integer" minOccurs="1"/>
<xs:element name="Side2" type="xs:integer" minOccurs="1"/>
<xs:element name="Side3" type="xs:integer" minOccurs="1"/>
<xs:element name="Side4" type="xs:integer" minOccurs="1"/>
</xs:sequence>
appears in many places.
This seems kinda bad. Is there any way of having something that is a placeholder or something for that sequence. I would make a new type that has all those, but I need to maintain backwards compatibility, so I need the xsd to take the same xml it was able to, so I can't for example turn
<Square>
<Side1>1</Side1>
<Side2>1</Side2>
<Side3>1</Side3>
<Side3>1</Side3>
</Square>
into
<Square>
<QuadSides>
<Side1>1</Side1>
<Side2>1</Side2>
<Side3>1</Side3>
<Side4>1</Side4>
<QuadSides>
</Square>
I need to still accept the first xml. Is there any way to do this?