This solves most of your conditions, however the harder one is allowing the any order part. Since you are dealing with complex types your primary usage is the Sequence command. There are others but they do not work for your scenarios either. Also, while this may seem simple from a pure xml perspective it's not from a validation perspective. The main thing to note is that the way this doc is built you would have to put all your <A>
records first and all your <B>
records second. Here is a link to some of the schema data: w3schools
There may be some much more complicated ways to do what you want but this gives you the basic pattern at least.
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Avalue">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="C" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="D" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="unbounded" name="E" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Bvalue">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="C" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="D" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="unbounded" name="E" type="xs:string"/>
<xs:element minOccurs="1" maxOccurs="1" name="F" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="A" type="Avalue"/>
<xs:element minOccurs="0" maxOccurs="unbounded" name="B" type="Bvalue"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>