XML·XML from well-formed documents to XSLT

Well-formedness

Close tags, escape characters and use CDATA deliberately.

Beginner 12 min read Lesson 2 of 300 Challenge included
What you will be able to do
  • Escape & < > with entities.
  • Use CDATA for blocks of unescaped text.
  • Attribute values need quotes.
  • Well-formed is not the same as valid.

In plain English

A document is well-formed when it follows XML syntax: tags close, attributes quote and special characters are escaped. Validity is a separate, stronger claim defined by a schema.

wellformed.xmlHTML
<note>
  <text>A &lt; B &amp; C</text>
  <code><![CDATA[if (a < b) { run(); }]]></code>
</note>
Your turn

Escape an ampersand

Easy

Write the escaped form of the text A & B.

HTML · starter
A & B
Check your understanding before moving on.
Knowledge checkQuestion 1

What does CDATA do?

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 in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Namespaces
Lesson 2 of 300 · 0% of course