XML is a process by which an XML document is validated. An XML document is said to be valid if its content match with the elements, attributes, and associated Document Type Declaration (DTD), and if the document compiles with the constraints expressed in it. Validation is handle in two ways by XML parser.
- Well-formed XML document.
- Valid XML document.
Well-formed XML Document
- Non DTD XML files must use predefined character entities for amp (&), apos (single quote), gt (>), lt (<), quot (double quote).
- It must follow the ordering of the tag. i.e., inner tag must be closed before closing the outer tag.
- Each of the opening tags must closing tag or it must be self-ending tag. (<title>?</title> or <title/>).
- It has only one attribute in start tag, which needs to be quoted.
- It include the root element named as address.
- The child element name, company, and phone is enclosed in its self-explanatory tag.