← VCE Software Development U3O1

XML files: structure

XML stores data in nested, named elements. Each element has an opening and closing tag, and child elements sit inside a root element. The tags describe the data.

Understanding XML files: structure in VCE Software Development U3O1

What it does: The opening tag <name> is closed by </name>. The slash marks the closing tag, which makes the element complete. The students root element wraps everything else, and student and name are nested inside it as child elements. XML uses named tags to describe what each value means. Separating values with commas is how a CSV file works. An attribute sits inside the opening tag as name="value". The value must be in quotes in XML. Every opening tag needs a matching closing tag. The fix is to add </student> at the end.

Common mistakes: The closing tag must match the opening tag exactly. It should be </student>, not </studen>. The closing tag is missing its slash, so the name element is never closed. It should be </name>.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 98–113) and word search (Modules 72–113).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which XML element is correctly written?
<name>Mia</name><name>Mia</nme>
Matches
<student><name>Mia</student></name>
↓
The tags overlap. The name element must be closed before its parent student is closed, so the tags are not properly nested.
Applying
Meanings
Term
<student><name>Mia</name></student>
Meaning
XML stores data in nested, named elements. Each element has an opening and closing tag, and child elements sit inside a root element. The tags describe the data.
Practice
<students>
Testing
Gaps
<name>Mia<name>
Check Answer
Spots
1<students>
2 <student>Mia</studen>

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Desert Tortoise' badge — Desert Master, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which XML element is correctly written?
A. <name>Mia</nme>
B. <name>Mia</name> ✓
Every opening tag needs a matching closing tag with the same name. The closing tag starts with a forward slash.
2. Which statement about the root element of an XML file is correct?
A. There is one root element that contains all the other elements ✓
B. Each element in the file must be its own separate root element
A well-formed XML file has exactly one root element, such as <students>. All other elements are nested inside it.
3. Which XML shows a child element correctly nested inside its parent?
A. <student><name>Mia</name></student> ✓
B. <student><name>Mia</student></name>
Elements must close in the reverse order they were opened. The inner <name> element must close before the outer <student> element.
4. How does XML describe the data it stores?
A. Named tags such as <mark>88</mark> label each value ✓
B. Values are only separated by commas with no labels
XML uses named tags to describe what each value means. Separating values with commas is how a CSV file works.
5. Which line stores a value as an attribute of the element?
A. <student id=7>Mia</student>
B. <student id="7">Mia</student> ✓
An attribute sits inside the opening tag as name="value". The value must be in quotes in XML.

Match the Pairs

<student><name>Mia</name></student> → A student element with a child element name nested inside it, holding the data Mia
<student id="7"> → An opening tag with an attribute named id that has the value 7
Every element needs an opening tag and a matching closing tag with a forward slash → <name>Mia</name>
A well-formed XML file has one root element that contains all the other elements → <students><student><name>Mia</name></student></students>
<student><name>Mia</student></name> → The tags overlap. The name element must be closed before its parent student is closed, so the tags are not properly nested.
<student><name>Mia</name> → The student element is never closed, so the XML is not well-formed. It needs a closing </student> tag.

Key Term

<student><name>Mia</name></student>
XML stores data in nested, named elements. Each element has an opening and closing tag, and child elements sit inside a root element. The tags describe the data.

Fill in the Blanks

1. <name>Mia</name>
Hint: Type the symbol that turns an opening tag into a closing tag.
2. <students> <student>Mia</student> </students>
Hint: Type the name of the root element that this closing tag must match.
3. <student><name>Mia</name></student>
Hint: Type the child element's name so the opening tag matches its closing tag.
4. <student id="1"><name>Mia</name></student>
Hint: Type the operator that links an attribute name to its value.
5. <student id="1"><name>Mia</name></student>
Hint: Type the element name that matches this element's closing tag, so the XML is well-formed.

Spot the Error

Question 1
A <students>
B <student>Mia</studen>
C </students>
Line B — The closing tag must match the opening tag exactly. It should be </student>, not </studen>.
Question 2
A <school>
B <student>
C <name>Mia<name>
D </student>
E </school>
Line C — The closing tag is missing its slash, so the name element is never closed. It should be </name>.
Question 3
A <student>
B <student id="1">Mia</student>
C </students>
Line A — The root element's opening tag must match its closing tag </students>. It should be <students>.
Question 4
A <students>
B <student>
C <name id=7>Mia</name>
D </student>
E </students>
Line C — Attribute values must be in quotes in well-formed XML. It should be id="7".
Question 5
A <school>
B <student>
C <name>Mia</name>
D <student>
E </school>
Line D — This line should close the student element with </student>. Without the slash it opens a new element instead.

Student with a class code? Join your class →