How to use XSD Empty Element in XML

In this article I am going to explain about XSD Empty Element in XML.
  • 2364

XSD Empty Element

An XSD Empty Element is an such type of element that does not contain Contents. Its only contain attribute.

Example

<Employee name="EmpId" />

 

In above example "Employee" have no content. For defined type with no content we must defined that allow element in its content.

 

<xs:element name="Employee">

  <xs:complexType>

    <xs:attribute name="EmpId" type="xs:positiveInteger"/>

  </xs:complexType>

</xs:element>

 

For defined type we can also give the complex type element name.

 

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

 

<xs:complexType name="Detail">

  <xs:attribute name="Empid" type="xs:positiveInteger"/>

</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
 
© 2020 DotNetHeaven. All rights reserved.