XML Validation

In this article I am going to explain what is XML Validation. XML validation is used to check XML document.
  • 2325


In this article I am going to explain what is XML Validation. XML validation is used to check  XML document. In XML Validation we check formatting of XML Document and is it fallow proper structure. XML document must fallows some rules for writing a well structured and formed XML Document. A valid XML document must respect all rules and convention defined by XML schema. XML is a case sensitive language so be careful when you are working with XML.

Here I am explaining some basic rules that must be fallowed in writing a XML document 

  • XML documents must have a root element
  • XML elements must be properly nested
  • XML tags are case sensitive
  • XML attribute values must be quoted
  • XML elements must have a closing tag

In architecture of XML Document there are three part

Valid XML Documents

A "Valid" XML document is a "well formed" and "well structured" XML document. It must fallow all rules of a Document Type Definition (DTD).


XML Document Type Definition (DTD) is used to define the structure of XML document. XML Document Type Definition (DTD) provides an application independent way of sharing data. XML Document Type Definition (DTD) independent groups of people can agree to use a common document type definition (DTD) for interchanging data. 

XML Schema

An XML schema is a description of a type of XML document. An XML schema is used to define constraints on structure of XML document. These constraints may be combination of grammatical rules governing the order of elements, some attribute or more specialized rules.


Fallowing example is well formed XML Document.

<?xml version="1.0" encoding="utf-8" ?>
     <book category="sport">
        <title>Cricket Master</title>
        <author>Denish Richchi</author>
    <book category="music">
        <title>Learning Music</title>
        <author>Javed Akhater</author>

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.