How to use XSD Element Only in XML

In this article I am going to explain about Complex type Element only in XML.
  • 1806

XSD Element Only

An XSD Element such type of element that contain only other element.

Example

<Element>

  <Name>Ajay</Name>

  <Add>Delhi</Add>

  <Company>MCN Solution</Company>

</Element>

 

We can defined schema of "Employee" Element as follwoing.

 

<xs:element name="Employee">

  <xs:complexType>

    <xs:sequence>

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

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

    </xs:sequence>

  </xs:complexType>

</xs:element>

 

Defined Schema with Complex type.

 

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

<xs:complexType name="Detail">

  <xs:sequence>

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

    <xs:element name="Add" 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
 
© 2019 DotNetHeaven. All rights reserved.