HTML (HyperText Markup Language) and XML are both markup languages that use tags in angle brackets, and both come from the older SGML family. However, they were designed for different purposes. HTML is designed to display data, telling the browser how to present headings, paragraphs, images and links. XML is designed to carry and describe data, saying what the data is, not how it looks.
Key terms
- HTML
- markup language for displaying web pages
- XML
- markup language for describing and transporting data
- Predefined tags
- tags whose meaning is fixed, as in HTML
- Case-sensitive
- treating upper and lower case as different
- XHTML
- HTML written according to XML rules
- Markup language
- a system of tags that annotate text
Summary
- HTML displays data; XML describes and transports data.
- HTML tags are predefined; XML tags are user-defined.
- XML is strict and case-sensitive; HTML is forgiving.
- They are complementary technologies.
In everyday life: A news website in Ethiopia may publish its articles as HTML pages for readers and as an XML (RSS) feed for news apps.
Check yourself
- Give three differences between HTML and XML.
- Why does a browser still show a page with a missing HTML closing tag?
- When would you choose XML over HTML?
Practice questions
1. What is the main purpose of HTML compared with XML?
- A. HTML describes and transports data
- B. HTML displays data in a browser
- C. HTML stores databases
- D. HTML replaces CSS
Show answer
Answer: HTML displays data in a browser
HTML focuses on presenting content (headings, paragraphs, images), while XML focuses on describing and carrying data.
2. True or false: XML is case-sensitive, so <Book> and <book> are different tags.
Show answer
Answer: True
XML treats upper and lower case as different, so start and end tags must match exactly.
On WeLearn
The full lesson: reading notes, worked examples, class activities and the Unit 4 quiz
Study HTML vs XML on WeLearnTeach HTML vs XML with WeLearn
We will bring a demo to your school: a lesson on your interactive TV, a virtual lab and a classroom game, with your own teachers.
