XML basics
Elements, attributes, the prolog and the document tree.
What you will be able to do
- One root element per document.
- Elements nest; tags must close.
- Use attributes for metadata, not repeated data.
- The prolog declares the XML version.
In plain English
XML is a markup language for structured data. A document has one root element and a tree of nested elements. Attributes describe elements but should not replace child data when the value can repeat.
<?xml version="1.0" encoding="UTF-8"?>
<course id="css">
<title>CSS Grid</title>
<lessons>
<lesson minutes="18">Grid basics</lesson>
</lessons>
</course>Your turn
EasyWrite a root element
Write the opening and closing tags for a course root with one title child.
HTML · starter
<course>Check your understanding before moving on.
Knowledge checkQuestion 1
How many root elements can an XML document have?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.