XML stands for eXtensible Markup Language. Its purpose is to draw and structure information on the net, for mobile apps, and elsewhere. Are yous wondering how this works and what XML is used for? Permit us help you understand the details.

What Are Markup Languages?

Markup languages annotate text or add together additional information. These annotations remain invisible to the finish-user. The "machine", such as your browser, reads these annotations before processing and presenting the text as instructed by the markup commands.

According to Wikipedia:

"The idea and terminology evolved from the 'marker upwardly' of newspaper manuscripts, i.e. the revision instructions by editors, traditionally written with a blue pencil on authors' manuscripts. In digital media, this 'blue pencil instruction text' was replaced by tags, which indicate what the parts of the document are, rather than details of how they might exist shown on some brandish."

A well-known example of a markup language is HTML (HyperText Markup Language). While HTML (and other programming languages) ascertain the look of a website, you should never run into a trace of the code. What y'all do see is its interpretation by your browser. For example, font formatting or embedded images.

How Does XML Work?

XML is a meta markup language developed for the internet. It's a simplification of SGML (Standard Generalized Markup Language), the mother of all markup languages. XML is extensible because users can add and define new tags or edifice blocks. By adding building blocks, users can adapt XML to their needs.

To explain how this all works, let me accept a bit of detour, using HTML and CSS as examples.

How XML Relates to HTML

XML is similar to HTML, simply because users tin add their own building blocks, it allows for more flexibility. A key difference between HTML and XML is that HTML defines how data looks, while XML defines what data is. That'southward why XML cannot replace HTML, rather it extends it.

To describe information, XML relies on Document Type Definition (DTD). Yous could say that this is the automobile'due south dictionary. It allows the car to understand the markup language. Thus, each document must start by defining the type of DTD to be used. HTML uses the same principle. The code you'll detect on many websites could await something like this:

                      <!doctype html public "-//w3c//DTD html 4.0//en">                  

This specific example tells your browser that the DTD is html 4.0 in English language. The browser tin and so go alee and compare each of the given commands to its DTD, which tells it what to practise with each command. That's how the command

                      <b>                  

translates to bold text or

                      <u>                  

to underlined text.

Doctype HTML XML document
Epitome Credit: photovibes1/Depositphotos

How CSS Solves an Effect With HTML

The problem with HTML is that it consists of a static set up of commands. Whenever you want to define sure attributions, you need to type these commands. Over and over again. While this makes HTML straightforward and like shooting fish in a barrel to learn, it also limits its flexibility.

For example, say you lot want to change the size or color of a header that you have used a dozen times throughout your website. Imagine you had to change the attribute of each of the i dozen headers individually. How boring!

In web design, Cascading Way Sheets (CSS) have eliminated this tiresome editing of HTML documents. Now, you only add the attribute "H1" to your header on the website and in the style sail you define what an "H1" header looks like. And when you want to change the look of that header, you lot simply change it in one place, i.e. the style sail. Trouble solved.

Thinking of starting your ain website? MakeUseOf readers can get special discounts if they sign upwards for InMotion Hosting using this link or Bluehost using this link.

How XML Handles Data

XML structures and defines information. It doesn't bother with specific attributes, similar size or color. Its edifice blocks are similar to HTML tags that relate to a CSS. Information technology plainly defines the title, headers, text, and other elements of the document and leaves the interpretation to the auto.

For a much more thorough explanation, I recommend this introduction to XML.

What Is XML Used For?

XML has found wide awarding. Today, various programs and devices use it to handle, structure, shop, transmit, and display data. For example, it's widely used in B2B data exchanges. XML is too the standard for Office file formats, including Microsoft Part and Google Docs files.

Rather than integrating data into an HTML certificate, it outsources it to separate XML files. Since XML stores information in plain text format, the storage is independent of your platform and your data tin can be exported, imported, or just moved much more easily.

Many other languages are based on XML, including XHTML, WAP for handheld devices, or RSS for feeds. For case, as a commenter pointed out, if you add together /feed to the terminate of the URL of this article y'all're reading, yous'll see the XML RSS code of this article: click here to run into.

How to Open up an XML File

As mentioned above, XML stores information in obviously text. That's why you tin can open XML files with a number of different programs. By and large, right-click the XML file, select Open with from the menu, and choose a program. Yous tin try any of the programs below:

  • Windows Notepad or whatever other text editor
  • Notepad++
  • Any web browser

Y'all can also try an online XML viewer like the i from Lawmaking Adorn.

Y'all'll be able to read the file with any of the programs above, merely Notepad++ and defended XML viewers or editors volition color lawmaking XML tags and thus make information technology much easier to grasp the structure of the data. Note, however, that these programs cannot execute XML because all you can find inside the certificate is structured information.

The XML Format Demystified

XML isn't the net staple it used to be. Today, JSON is its virtually popular alternative to integrate information.

If you're a programmer, however, you lot'll even so have to work with XML occasionally.