XML Validity

An XML Document is said to valid if it is well formed and adhere the rules defined in Document Type Definition (DTD).

A well formed XML Document must be syntactically correct:

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

Lets take a look at Well formed XML Document

XML DTD

XML DTD is used to define the structure for an XML document. It defines the structure with a set of legal elements that can be used to create XML Document.