EXtensible Markup Language or XML is a way of capturing data in a very readable manner to the human eye. Summarized:
- XML is a markup language (much like HTML)
- XML was designed to hold/carry data (not to display data)
- XML tags are not predefined. You must define your own tags
- An XML tag can hold attributes (within the tag) and a value (enclosed by start and ending tags)
- XML tags can contain XML tags
- XML is designed to be self-descriptive
An example of XML: Peter places a post-it note to the milkman:
<note> <to>Milkman</to> <from>Peter</from> <heading>Post-it note</heading> <location>Front door of the house</location> <body>Hello Milkman, can I have 2 milk please ? Thanks!</body> </note>
The above should really demonstrate that XML is descriptive. It even shows where the post-it note is placed. Note too that there are no options to control how the note is output, XML is a markup language for data - not how this data is send, received or displayed. Hence XML does not do anything other than hold data.
The example above also demonstrates that tags can be embedded in tags, the <note>
holds all other fields, which makes the <heading>
part of the <note>
. Define your own tags where and when you need them. They have no predefined function like <B>
this is printed in bold</B> in HTML has. The same tag in XML would simply mean a field with the name B
.
There is a bit more to XML than demonstrated here, an XML has a header, like
<?xml version="1.0"?>
and an XML tag can hold attributes, like so:
<note date="17.10.2013">
<to>Milkman</to>
<!-- BTW: you can put comments into XML as well -->
...
Attributes can also be set up with single quotes, double in single or single in double (in case the attribute value needs to hold some sort of quote) - much like HTML.
Editor for XML - online
If you want to view your XML in an online editor, that also allows editing, check out xmlgrid.net.