How to use XSD Mixed Complex Type in XML
In this article I am going to explain about XSD Mixed Complex Type in XML.
XSD Mixed Complex type in XML
XSD Mixed Complex type such type of complex type that con contain element, text and attribute.
Example
<Message>
Hello Friend.<name>
Ajay
</name>.
<pincode>110096</pincode>
Message will be sand on <sendDate>2012-07-05</sendDate>
</Message>
|
In following we described schema of "Message" element. In following example we used mixed="true" for enable character data to appear between child element of "Message" element.
<xs:element name="Message">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="pincode" type="xs:positiveInteger"/>
<xs:element name="sendDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
|
In following example we defined name of complex type and type of "Message" element.
<xs:element name="Message" type="MessageType"/>
<xs:complexType name="MessageType" mixed="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="pincode" type="xs:positiveInteger"/>
<xs:element name="sendDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
|
Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here