XSD - Elemento de Mistura Complexa

O Complex Mix Element pode ter texto, atributos e elementos. Veja o seguinte exemplo -

<student rollno = "393">
   Dear <firstname>Dinkar</firstname>    
   <lastname>Kad</lastname>
   <nickname>Dinkar</nickname>
   <marks>85</marks>	 
</student>

Podemos declarar esse Texto Complexo usando as seguintes maneiras -

Use mixed = true

Defina complexType com o atributo "mixed" definido como true. O atributo "misto" permite ter dados de caracteres entre os elementos.

<xs:complexType name = "StudentType" mixed = "true">
   <xs:sequence>
      <xs:element name = "firstname" type = "xs:string"/>
      <xs:element name = "lastname" type = "xs:string"/>
      <xs:element name = "nickname" type = "xs:string"/>
      <xs:element name = "marks" type="xs:positiveInteger"/>
   </xs:sequence>
   <xs:attribute name = 'rollno' type = 'xs:positiveInteger'/>
</xs:complexType>

<xs:element name = 'student' type = 'StudentType' />

Use ComplexType sozinho

Defina um elemento de complexType apenas com o elemento de atributo necessário.

<xs:element name = 'student'>
   <xs:complexType mixed = "true">
      <xs:sequence>
         <xs:element name = "firstname" type = "xs:string"/>
         <xs:element name = "lastname" type = "xs:string"/>
         <xs:element name = "nickname" type = "xs:string"/>
         <xs:element name = "marks" type = "xs:string"/>
      </xs:sequence>
      <xs:attribute name = 'rollno' type = 'xs:positiveInteger'/>
   </xs:complexType>			  
</xs:element>