How to use XSD Complex Element in XML

In this article I am going to explain about XSD Complex Element in XML.
  • 2288

XSD Complex Element

XSD Complex element element is an such types of element that contain other element or other attribute. There are four type of Complex element that is following.

Other Element - Its contain only other element.




  <Company>MCN Solution</Company>


Text Element - Its contain only text.

<Emp name="Ajay">EmpDetail</Emp>

Empty Element - Not contain any value.

<Emp name="Ajay" />

Element and Text Element - Element that contain both Element and text.


Hello How are you<Emp name="Ajay">EmpDetail</Emp>


How to defined Complex Element

<xs:element name="Employee" type="Detail"/>

<xs:complexType name="Detail">


    <xs:element name="Ajay" type="xs:string"/>

    <xs:element Add="Delhi" type="xs:string"/>



If you are using method for describing above.

<xs:element name="Ajay" type="Detail"/>

<xs:element Add="Delhi" type="Detail"/>

<xs:element Company="MCN solution" type="Detail"/>


<xs:complexType name="personinfo">


    <xs:element name="Ajay" type="xs:string"/>

    <xs:element name="Kumar" type="xs:string"/>



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


© 2020 DotNetHeaven. All rights reserved.