XML Programming  «Prev  Next»

Lesson 6The goals of XML
Objective Brief explanation for each of the goals.

Goals of XML

Question: Why is the goal important; what does this mean for developer to provide some context.
After each goal, I find myself asking Why?
XML was created with specific design goals intended to make XML portable and simple to use.

10 Goals of XML

The XML Recommendation delineates the following 10 goals:
  1. XML shall be straightforwardly usable over the Internet.
    When you write XML it should be readily available over the Internet. XML is not intended as a programming language for stand-alone systems, but rather to be used across the Internet as a means of information interchange.
  2. XML shall support a wide variety of applications.
    The beauty of XML is that it was intended to be used for as many things as possible. This flexibility can sometimes make it more difficult to understand and ultimately, XML can be used to describe a Web page about object technology or a database of integrated circuits.
  3. XML shall be compatible with SGML.
    SGML or Standard Generalized Markup Language, is the ISO standard on which all XML, hence XHTML documents are based upon. If a document is not compatible with SGML, then it cannot be called XML.
  4. It shall be easy to write programs that process XML documents.
    XML was always intended to be easy to use and process and since XML is based on human-readable text, this makes it a lot easier for developers to figure out what is meant by the XML tags. This in turn makes it easier to write a program that processes those tags.
  5. The number of optional features in XML is to be kept to the absolute minimum, ideally zero.
    Ideally, there would be zero optional features. Optional features cause problems because they are not guaranteed to be present for a given situation. The more optional features there are in a system the more combinations there are for the system and so the more difficult the programming becomes.
  6. XML documents should be human-legible and reasonably clear.
    Rather than having elements that are named 3157d you would have an element named < first_name>. (The xml document can be written in such a way so that it is self-describing.) Someone reading your XML should be able to determine what the data is describing.
  7. The XML design should be prepared quickly.
    It is better to spend time building the data than it is on building an XML design.
  8. The design of XML shall be formal and concise.
    Only include as many elements as you need to be clear and additional extraneous information should be avoided.
  9. XML documents shall be easy to create.
    XML is intended to not require a special editor or tool to create. And in fact, most XML documents can be edited in a text editor like Notepad++.
  10. Terseness in XML markup is of minimal importance.
    When you are creating XML element names, first_name is better than fname because it is clearer and more human readable. While you do want to keep element names short, the shortness should not be at the sacrifice of human-readability.



The main advantage of XML is interoperability. It is much quicker to agree on or publish an XML format and use that to exchange data between different applications (with the associated metadata included in the file) than to have an arbitrary format that requires accompanying information for processing. Due to the high availability of cheap XML parsers and the pieces of software that read XML and enable interrogation of its data, anyone can now publish the format that their application deals with and others can then either consume it or recreate it. One of the best examples of this comes back to the binary files. Before Microsoft Word 2003, Word used a binary format for its documents. However, creating an application that could read and create these files was a considerable chore and often led to converters that only partially worked. Since Word 2003, all versions of Word can save documents in an XML format with a documented structure. This has meant the ability to read these documents in other applications as well as the ability to create Word documents using even the most basic tools. It also means that corrupted documents, which would previously have been completely lost, can now often be f xed by opening them in a simple text editor and repairing them. With this and the previously discussed advantages, XML is truly the best choice for enterpirse applications

The next lesson describes approaches to using XML.