How to use XSD Complex Element in XML
In this article I am going to explain about XSD Complex Element in XML.
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.
<Element>
<Name>Ajay</Name>
<Add>Delhi</Add>
<Company>MCN Solution</Company>
</Element>
|
Text Element - Its contain only text.
<Emp name="Ajay">EmpDetail</Emp>
|
Empty Element - Not contain any value.
Element and Text Element - Element that contain both Element and text.
<Employee>
Hello How are you<Emp name="Ajay">EmpDetail</Emp>
</Employee>
|
How to defined Complex Element
<xs:element name="Employee" type="Detail"/>
<xs:complexType name="Detail">
<xs:sequence>
<xs:element name="Ajay" type="xs:string"/>
<xs:element Add="Delhi" type="xs:string"/>
</xs:sequence>
</xs:complexType>
|
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:sequence>
<xs:element name="Ajay" type="xs:string"/>
<xs:element name="Kumar" type="xs:string"/>
</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