XML / EDI Basics

XML Schema

Message schema defines allowed data structure of an XML document. In other words, data sequence, occurrence and tag for each piece of information entered. Meaning and content of each tag is defined by a message standard. Usually data structure is defined using DTD (Document Type Definition) or 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 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 data sequence and allowed tags, but it has limited ability to express permitted data values. Especially for organizations participating in electronic data interchange, it is crucial that data is 100% valid. Therefore DTD is often sufficient only for XML documents which are intended to be visualized (to be interpreted visually). DTD has also limitations with XML namespaces which in turn limits its use in applications. Additionally, DTD is from the period before the "XML era". Therefore a syntax used to define DTD is not based on XML, in contrast to XSD.

Message schemas lack ability to state technical and business rules, specifically conditional ones, as well as various integrity requirements. Failure to fulfill these requirements raises issues which are difficult to detect manually. Without ability for detailed testing, errors are not detected before sending data to the recipient's system.

When you want to make sure your XML document is in line with XML schema, a test needs to be performed. We call it schema validation. As a complement for a message schema, it's recommended to publish a message implementation guideline. This guideline contains verbal descriptions of technical and business rules affecting on content requirements. Testing tools to verify that XML document conforms to the guideline has been rare and expensive. Truugo provides an easy and inexpensive way to set up a test profile, to perform both schema validation and rule-based validation at once.

Next article: Schema validation