XML (eXtensible Markup Language) is a markup language designed to store and transport data in a form that both people and computers can read. It was standardised by the World Wide Web Consortium (W3C). XML does not do anything by itself and has no predefined tags; instead, the author creates tags that describe the data, which is why it is called 'extensible'. For example, <student><name>Liya</name><grade>12</grade></student> describes a student record.
Key terms
- XML
- eXtensible Markup Language for storing and transporting data
- Element
- a start tag, content and end tag
- Root element
- the single element containing all others
- Attribute
- extra information inside a start tag
- Well-formed
- following all XML syntax rules
- Valid XML
- well-formed and conforming to a DTD or schema
- DTD/XSD
- documents defining the allowed structure
Summary
- XML stores and transports data with user-defined tags.
- It forms a tree with one root element.
- Well-formed XML follows strict syntax rules; valid XML also follows a DTD/schema.
- Used for data exchange, configuration, feeds and documents.
In everyday life: Bank systems and government agencies in Ethiopia exchange records in structured formats like XML so that different software can read the same data.
Check yourself
- Why is XML called 'extensible'?
- List four rules for well-formed XML.
- What is the difference between well-formed and valid XML?
Practice questions
1. Which XML fragment is well-formed?
- A. <name>Sara</Name>
- B. <a><b>text</a></b>
- C. <item id="5">Pen</item>
- D. <price>20
Show answer
Answer: <item id="5">Pen</item>
It has a quoted attribute and a matching end tag. The others have case-mismatched tags, wrong nesting or a missing end tag.
2. True or false: XML has a fixed set of predefined tags like HTML.
Show answer
Answer: False
XML is 'extensible': authors define their own tags to describe their data. HTML is the one with predefined tags.
On WeLearn
The full lesson: reading notes, worked examples, class activities and the Unit 4 quiz
Study Introduction to XML on WeLearnTeach Introduction to 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.
