XML stands for eXtensible Markup Language. XML is a markup language for documents containing structured information that helps define and structure information for the web. What is a markup language? A markup language is a system for annotating a text in a way that is easily distinguishable from the text. One example for this would be a magazine editor correcting the first draft of an article using a red pen. Markups are typically omitted from the version of the text, which is displayed for the end-user. In the example from before, the corrections in red pen would not be printed in the magazine released for consumers. In terms of computers, a markup language is a mechanism to identify structures in a document. Another form of Markup Language that most people are somewhat familiar with is Hyper Text Markup Language, or HTML. You often see HTML at the end of many WebPages.
Like HTML, XML works by using tags and attributes to display the content in a desired format. However, unlike HTML, the tags are not predefined, thus leaving it to the user of XML to create their own tags. Where HTML is rigid, XML is fluid, which is why it is known as EXTENSIBLE Markup Language because the language can be extended by any one.
But what exactly is a Tag? A tag is a way to encode data. Tags are words or phrases enclosed inside a "less than" and a "greater than" sign. For example to encode a name one might create a tag like this, < name >. Since XML has no restrictions on tags, one could technically write anything between the less than, greater than signs and get the same result. However one must remain consistent, and use the same tag for the same type of data.
In the above example, the information is not yet encoded. to encode something, one needs an open tag and a closed tag. The open tag comes first followed by the information and lastly the closed tag, which is identical to the open tag except it has a "/" in front of the name of the tag. open tags and closed tags are also called start tags and end tags respectively. Here is an example of a complete tag.
< name >Sara< /name >
In the example, "< name >" is the open tag, "Sara" is the data, and "< /name >" is the closed tag.
There is no limit to making tags in XML, and it is even possible to place tags inside other tags to organize more complicated data. For example, one might want to remember more than the name, but also the relationship to the person, their phone number, address, etc. That would look somethiing like this.
< friend >
< name >Sara< /name >
< phone number >909-555-0983< /phone number >
< address >123 west fake st.< /address >
< /friend >
There is one more type of tag called empty-element tag. In Empty element tags, the tag comes only at the end of the data and the "/" comes at the end of the tag instead of thebeginning. Here is an example.
< next line/ >
XML is now as important for the Web as HTML was to the foundation of the Web. XML is everywhere. It is the most common tool for data transmissions between all sorts of applications, and is becoming more and more popular in the area of storing and describing information.