XSD (XML Schema Definition) is a World Wide Web Consortium (W3C) recommendation that specifies how to formally describe the elements in an Extensible Markup Language (XML) document. This description can be used to verify that each item of content in a document adheres to the description of the element in which the content is to be placed. XSD 1.1 became an approved W3C standard in April 2012.
XSD can also be used for generating XML documents that can be treated as programming objects. In addition, a variety of XML processing tools can also generate human readable documentation, which makes it easier to understand complex XML documents.
In general, a schema is an abstract representation of an object's characteristics and relationship to other objects. An XML schema represents the interrelationship between the attributes and elements of an XML object (for example, a document or a portion of a document). The process of creating a schema for a document involves analyzing its structure and defining each structural element encountered. For example, a schema for a document describing a website would define a website element, a webpage element, and other elements that describe possible content divisions within any page on that site. Just as in XML and HTML, elements are defined within a set of tags.
XSD has several advantages over earlier XML schema languages, such as Document Type Definition (DTD) or Simple Object XML (SOX). XSD is written in XML, which means that it doesn't require intermediary processing by a parser. Other benefits include self-documentation, automatic schema creation and the ability to be queried through XML Transformations (XSLT).
There are many challenges and limitations with XSD as well. Some detractors have argued it is unnecessarily complex, lacks a formal mathematical description and has limited support for unordered content.
Continue Reading About XSD (XML Schema Definition)
Dig Deeper on Development implications of microservices architecture