Battery Markup Language (BatML) Standard

 

XML Schema

A W3C XML Schema is a method to describe the structure and relations of an XML document. It is usually defined in terms of rules and syntactical constraints that are imposed on the data stored in the document. There are several XML Schema languages in widespread use; the one used in BatteryML is of the W3C XSD (XML Schema Definitions) type. This type provides the most flexibility and is recommended by the W3C.

The XML Schema grammar specifies language for describing the structure and content of data in XML documents, either in file or stream format. It goes beyond basic syntax constraints of XML. It states precise rules that XML document structure and content must satisfy, and enables more complex relations in XML data sets with respect to uniqueness and referential integrity.

XML Schema document is an XML representation of the XML Schema. It specifies a contract between the entities exchanging data, in that it defines expectations on data format and enables validation of the data document before attempting to operate of the data stored within it.

XML Schemas define valid structure of an XML document, its elements, element hierarchy and order, element attributes, element existence, uniqueness and cross-referencing. It enables modularization and re-use. XML Schemas that are developed for domain-specific problems, if properly composed, can be re-used to encapsulate the relevant rules and constraints of those domains. The XML Schema field is relatively new so that modular, re-usable domain-specific languages are still not very common.

From a practical perspective, XML Schemas are complex to write and have a steep learning curve. There are two main reasons for it. The first is that writing an XML Schema forces developers to define a good data model similarly as an object-oriented program requires definition of good data objects. Secondly, the XML Schemas must be very precise. They must consider all the data possibilities and their boundary conditions, carefully expressing them using a language of constraints and rules.

XML Schema Tutorial

A good introduction to XML Schema can be found on w3schools XML Schema Tutorial website. Since XSD schemas are XML documents, you may also view them in your browser by downloading the XSD file, changing their extension to XML, and reloading them into the browser.

Books on XML Schemas

Most recent books on XML contain chapters on XML Schemas. There are relatively few books entirely devoted to XML Schemas which provide more detailed information necessary for someone interested in XML Schema development. Suggested books are: