complexType mixed="true" : complexType « XML Schema « XML






complexType mixed="true"

File: Data.xml

<?xml version="1.0"?>
<Letter xmlns="http://www.java2s.com"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation=
                              "http://www.java2s.com
                               Schema.xsd">
    <Body>
       Dear Sirs:
            This message is <emp> very </emp> useful.
    </Body>
</Letter>


File: Schema.xsd

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.java2s.com"
        xmlns="http://www.java2s.com"
        elementFormDefault="qualified">
    <xsd:element name="Letter">
        <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="Body" minOccurs="0" maxOccurs="unbounded">
                     <xsd:complexType mixed="true">
                         <xsd:sequence>
                             <xsd:element name="emp" type="xsd:string" maxOccurs="unbounded"/>
                         </xsd:sequence>
                     </xsd:complexType>
                 </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

 








Related examples in the same category

1.Define a complexType
2.Definition of a student element uses primitive types for the child elements
3.complex type with sequence
4.complexType outside the element
5.Anonymous complex type and sequence
6.Complex type with group reference
7.Complex type with complex content
8.Build Complex type with simple Type
9.complexType with extension
10.complexType with restriction
11.Nested complexType