Breadcrumbs

XML Syntax

XML stands for eXtensible Markup Language and is a markup language. Those familiar with HTML will find XML not to difficult to figure out.

What does XML do?

One thing XML doesn't do will disappoint many, but XML wasn't made to display data as HTML was. XML was designed to organize and describe data. XML allows you to hold and create data. XML is also portable so it can go to many platforms unlike previous markup languages like XML.

XML was made to do nothing, it doesn't do anything except creating structure for storing portable data.

In XML tags are not predefined so you define your own tags. XML also uses a DTD to describe the data.

Well why should I learn XML?

Why should you learn XML if it doesn't do anything? XML allows for data to be portable going from computers to cell phones with ease and using portable languages such as Java you can go to a new level of data storage and code to process the code and use it in applications.

XML also allows for exchanging data between incompatible systems and used around the world to store files in plain text format. Since XML data is stored in plain text format, XML provides a software- and hardware-independent way of sharing data.

This makes it much easier to create data that different applications can work with. It also makes it easier to expand or upgrade a system to new operating systems, servers, applications, and new browsers. The XML data is also available to more people with its portability.

Databases

XML is also used for databases to store portable information and then applications are made to store, read, and edit the data within the XML database.

Here is an example of organizing and describing a list of three users and their usernames and email:

Code: XML

<members>
    <user>
        <username>Ethan</username>
        <email>ethan@example.com</email>
    </user>
    
    <user>
        <username>Matthew</username>
        <email>matt@example.com</email>
    </user>
    
    <user>
        <username>John</username>
        <email>john@example.com</email>
    </user>
</members>

This data is very easy to understand and the tags explain what is held inside them. As you see I invented my own tags to create my list of members and it is valid XML. No tags are predefined as I mentioned above. Yet this XML data doesn't do anything there are ways to create programs to read this data and use it in applications, yet it is far advanced for Basic XML.

In XML all tags have to close in the same order they are declared so this isn't valid:

Code: XML

<user>
    <username>John</user>
</username>

It may seem right as they all close, but it isn't as in XML everything has to close in the order declared.

Future of XML

As the years go on XML will be the main way data is shared, transferred, and stored. Learning it now will be useful in the future of storing data and compacting it.

Not much to XML syntax with only tags until you get into attributes and elements, but you have learned what XML can do and why you should learn it along with some basic XML syntax.

Tags: