Storage and Transfer of Data with XML

XML stands for eXtensible Markup Language. It is a scripting language widely used for the storage and transfer of data over the web. The basic difference between HTML and XML is that XML is exclusively used for the storage of data and not for displaying it. Besides, XML tags are not predefined. XML allows the programmer to define his own tags and his own document structure.

The ease of data storage is quite evident with XML. If you need to display dynamic data in your HTML document, it will take a lot of work to edit the HTML each time the data changes. With XML, data can be stored in separate XML files. This way you can concentrate on using HTML for layout and display, and be sure that changes in the underlying data will not require any changes to the HTML. Further, XML data is stored in plain text format. This provides a software- and hardware-independent way of storing data.

XML documents use a self-describing and simple syntax. It divides the code into a hierarchy and treats elements as root elements and child elements. For example, consider the code:

The first line is the XML declaration. It defines the XML version (1.0) and the encoding used. The next line, <note>, describes the root element of the document. The next 4 lines describe 4 child elements of the root (to, from, heading, and body). The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree. The basic syntax goes like this:

Because of the use of trees, XML is particularly efficient when it comes to the management and storage of large data structures.

BlueHost | HostGator | Media Temple