How to use Validation in XML

In this article I am going to explain about XML validation.
  • 1650

XML Validation

XML is mark up language like HTML. It is case sensitive language so it is very necessary different between Capital and small at the time of writing XML code.  XML has some rule that must be follow.

  • An XML document must have a root element.
  • In XML document every element have must be closed tag.
  • Every element must be nested.
  • Attributed values must be quoted.
  • XML tag are case sensitive.
  • In XML we can create own type tag.

An valid XML Document

<?xml version="1.0" encoding="iso-8859-1"?>




  <Company>MCN solution</Company>




XML DTD stands for XML Document type definition. The purpose of DTD Its define the structure of XML element its also define the legal element in XML document with structure.

<!DOCTYPE root


  <!ELEMENT root (Name,Add,Company,Salary)>



  <!ELEMENT Company (#PCDATA)>

  <!ELEMENT Salary (#PCDATA)>


XML Schema

<xs:element name="root">




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

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

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

      <xs:element name="Salary" 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.