What is XML?

XML stand for Extensible Markup Language and is used to store information in a custom defined format. XML on its own does not do anything, it just a way to organise information in a defined document layout. Usually XML is used to send information in a specified format or to define structure for other mark up languages, such as HTML.

The below code snippets shows a basic XML document. There are things called tags in XML document. In the example below there are 5 defined tags, suchas the message tag. Every tag is defined within angle brackets ‘<..>’ and then has an ending tag which includes the name of the tag and a forward slash ”. Everything written in between the opening and closing tags is the contents of the tag. Contents of a tag can include other tags, plain text, numbers, anything.

    <to>John Smith</to>
    <from>Jane Doe</from>
    <body>This is an urgent message.</body>

The tags within our XML snippet above are not special, they are custom tags that are made up. An XML file can contain any tags, with any contents. Everything must be within tags, otherwise it will be an invalid structure. The file must end in a ‘.xml’ suffix similar to how a word document ends with ‘.doc’ or ‘.docx’.

Leave a Reply