XML Schema Definition (XSD) defines the structure and legal elements and attributes of an XML document. An XSD specifies elements and complex types that can appear in an XML file and places restrictions on values like data types, lengths, formats and more. It also defines the order of child elements and how many times elements can appear.