Introduction to XML Schema: Structure

The structure of an XML schema document consists of declarations that describe the valid building blocks of an XML document. XML schema declarations also specify the constraints that are applicable to the attributes and elements defined in an XML document.

For example, consider that an organization wants to share XML documents that contain employee information. The organization decides to create XML schemas to describe the structure of XML data. In the XML schema, the organization can specify the following constraints:

  • The EmpDetails element must contain only one EmpDept element, followed by the EmpName, EmpAddress, and EmpAge elements.
  • The EmpNumber element must contain exactly eight characters.
  • The EmpAge element must contain a value less than 100.
  • The EmpInitials element contains data that follows the regular expression [A-Z][A-Z].
The graphic shows the structure of an XML schema document.
Click the Next button to continue.