=== Create XML file === I created a xml file with animals and their attributes. \\ // animals.xml // Cow 800KG 2 1 1 2 yes 4 Sheet 150KG 2 1 1 2 yes 4 Horse 500KG 2 1 1 2 yes 4 Pig 300KG 2 1 1 2 doubtful 4 Mockingbird 0.5KG 2 1 1 2 yes 2 Fur Seal 450KG 2 1 1 2 yes 0 Habor Seal 450KG 2 1 1 0 yes 0 === DTD file for animals === The XML file above will be validated against a DTD file. And the DTD file is defined below === Validate using DTD === This code reference the DTD file in the XML file. === XSD XML schema === Now I switch to XSD. Below is the XSD file I am going to use \\ === Use XSD file in XML === The syntax to link the xsd file to the xml file is It is defined in the root element as attribute. === Validate the XSD itself === I use the w3c validate tool for the XSD. \\ http://www.w3.org/2001/03/webdata/xsv It is successfully validated Schema validating with XSV 3.1-1 of 2007/12/11 16:20:05 * Target: file:/usr/local/XSV/xsvlog/tmp2yEmYsuploaded (Real name: animals.xsd) * docElt: {http://www.w3.org/2001/XMLSchema}schema * Validation was strict, starting with type [Anonymous] * The schema(s) used for schema-validation had no errors * No schema-validity problems were found in the target === validate the XML file with DTD === http://validator.w3.org/check \\ The above validator is used. In the first attempt it found 7 errors which are all of the same type Line 21, Column 15: value of attribute "id" invalid: "0" cannot start a name ✉ It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit. . I added "a" in front of the id value, i.e ie="a0001". Then it passed the check without any error This document was successfully checked as XML! Result: Passed, 1 warning(s) And the only warning comes from the encoding. As I copy/paste the code directly into the online checker, it has to trust me with that the encoding is UTF-8 as I defined.