XML DTDs Vs XML Schema

XML is incredibly versatile and great for storing data and transporting it across systems. You can create XML easily enough using a plain text editor. A DTD or XML schema is a useful way of providing other systems with a blueprint of your XML file so that they know what to expect.

XML is ideal storing and connecting info among various systems as well as browsers, it is completely system independent this also helps it be suitable for storing and transporting data over the world wide web.

xml iconBy way of an example concerning precisely how flexible and versatile XML is, you are able to converse with web services making use of say a Microsoft .net framework using a UNIX system written in C. Even so, in order for this to function you require a blueprint that can explain to both systems, the format of the XML data or document, this typically is by way of some type of schema or DTD.

The schema or DTD can outline the format or layout of the XML file so that it will be able to be read or parsed with the acquiring system, ultimately XML is a meta language so can’t carry out this kind of function by itself.

There are two main advantages of this, the first is that this ensures that your data will make it beyond the parsing phase as the framework has already been agreed and this really helps to weed out any data that’s not supposed to be there. The second thing, it’s less complicated for developers to understand what can be obtained as the protocol standard is documented.

About DTD, Document Type Definition

DTD is short for document type definition and as previously stated, it’s a means of sharing with other systems the design and makeup of an XML file, so that the acquiring program is aware what to expect therefore that it could interrogate the obtained XML data to confirm that what is received is what is expected.

For example, the DTD will clearly define the elements that are being contained in the document and the attributes of the elements, along with the ordering and nesting of these elements.

The DTD is called in or incorporated by a computer programming phrase known as “declared”, the DTD is declared using what is named a DOCTYPE declaration beneath the XML declaration within the XML document.

The DTD may be included inline or externally, inline since the name suggests is within the XML document itself, in contrast to an external is outside of the XML document.

One can find good and bad points to both methods having said that inline is better if your documents are going to be kept and used offline.

About XML Schemas

XML schemas are an evolution around the DTD method and thus widely regarded as being an improved and more powerful method, actually, schemas are also XML files with their own DTD and operate by referencing the XML Schema Namespace.

XML Schemas give you a list of basic types, they comprise of most basic development kinds such as integer, byte, string and floating point numbers, in addition, they expand into Internet data types such as ISO country and language codes (en-GB for example).

The author of an XML Schema then uses these core types, along with various operators and modifiers, to create complex types of their own. These complex types are then used to define an element in the XML Document.

An entire XML schema tutorial is available here, additionallyHealth Fitness Articles, you can consider a good XML ebook from highly regarded publishers, for instance, O’Reilly publishers.

This was a guest post from Michael Dupre, an experienced writer in the field of XML and markup languages with a passion for programming and technical data.

Leave a Reply