XML Validation

An XML document with a correct syntax is well-formed XML file.

An XML document validated against a DTD or schema is a valid XML file.

Well-formed XML instance:

<?xml version = "1.0" encoding = "UTF-8"?> <messages>     <message>         <from>James</from>         <to>Peter</to>         <title>Meeting</title>         <text>Remember our meeting</text>     </message> </messages>
Example XML file valid against a DTD:
<?xml version = "1.0" encoding = "UTF-8"?> <! DOCTYPE note SYSTEM "message.dtd"> <messages>     <message>         <from>James</from>         <to>Peter</to>         <title>Meeting</title>         <text>Remember our meeting</text>     </message> </messages>