Message schema defines the allowed data structure for certain XML documents. In other words, data sequence, occurrence and tag for each piece of information entered. Meaning and content of each tag is defined in the message standard. In general, the document data structure is defined in the DTD (Document Type Definition) or in the XSD (W3C XML Schema). Use of other message schemas such as Relax NG is rare. Today, most of the structured data formats are described using in the W3C XML schema.
XSD schemas are preferred over DTD for several reasons. DTD's power of expression is limited. It can be used to express the data sequence and the allowed tags, but its ability to express the permitted values within the data is limited. Especially, for the organizations participating in electronic data interchange, it is crucial the information is 100% correct. Therefore DTD is often sufficient only with XML documents which are intended to be visualized. I.e. in cases where the information is interpreted visually. DTD has also limitations with XML namespaces which in turn limits its use in applications. Additionally, the DTD is from the period before the "XML era". Therefore the syntax which is used to define DTD is not based on XML, in contrast to XSD.
Message schema's shortcoming is the inability to include definitions for technical or commercial rules regarding the XML document. Commonly needed rules are specifically conditional, as well as various integrity requirements. These requirements generally result in errors which are very difficult to detect visually, thus without further testing, errors are detected only after sending the data to the recipient's system.
When we want to make sure the XML document is created according to the XML schema, a test needs to be performed. We call it as schema validation. In general, with the message schema, we create a message implementation guideline. This guideline contains a verbal description of context with related technical and business rules affecting on the content requirements. Testing tools to independently verify the material conforms to the guideline are rarely offered. By specifying a test profile, one can test in one run for both, the XML validity, and the content rules.