A few words about markup languages

1 min read

A markup language is a computer language that uses tags to define elements within a document. As markup languages are readable by human users, files written in this format contain standard words rather than the programming syntax commonly found elsewhere. Of the various markup languages, HTML and XML are the most widely used.

HTML is used when creating web pages, with various HTML tags that define the content. For example, basic tags such as <body> and <head> refer to sections of the page, whilst <form> and <image> refer to elements within the page’s content. Most elements require a start tag and an end tag, and the content is placed between these tags.

However, XML is used to store structured data, rather than to format the content of a page. HTML documents contain predefined tags, whilst XML files use custom tags to define elements. For example, XML files storing data for computer models may contain:

<computer>
  <manufacturer>brandname</manufacturer>
  <model>computermodel</model>
  <components>
    <processor>processortype</processor>
    <ram>ramsize</ram>
    <storage>storagecapacity</storage>
  </components>
</computer>

XML is known as an ‘extensible markup language’ because it allows you to use custom tags to represent different elements. All XML files are saved in standard text formats, making it easier for programs to read or analyse the data they contain. As a result, XML is often the best choice when exporting and sharing structured data via programs.

As HTML and XML files are saved in a simple text format, they can be viewed using a standard text editor. Conveniently, in most browsers you can use the ‘View Source’ option in the View menu to view a page’s HTML source.

Back to the blog