XML DTDs Vs XML Schema

Jan 19
13:08

2015

Michael Dupre

Michael Dupre

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

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.

mediaimage

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

By 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's 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, its 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, additionally, you can consider a good xml ebook from highly regarded publishers for instance O’Reilly publishers.