LOGBOOK

HELP

Quiz Entry - updated: 2026.06.23

What does it mean for an XML document to be "well-formed", and what are the core rules?

Well-formed means the tags follow XML's structural grammar — properly nested, one root, every start-tag closed — so any parser can read it without choking.

XML lets you invent tag names, but it is strict about how you write them. A document that breaks these rules is rejected outright by parsers (it won't even load), so "well-formed" is the minimum bar:

  1. One root element — exactly one top-level element wraps everything.
  2. Every element is closed — a start-tag <m1> needs a matching end-tag </m1> (or the self-closing form <m1/>).
  3. Proper nesting, never crossed<m1><m2></m2></m1> is fine; <m1><m2></m1></m2> is illegal because the tags overlap instead of nesting.
  4. Case-sensitive<Name> and <name> are different elements and won't match each other.
  5. Quoted attribute valuesid="123", not id=123.
  6. Escape special characters — write &lt; for < and &amp; for &, since the raw characters mean "tag" and "entity".
<!-- Illegal: tags cross over -->
<a><b></a></b>

<!-- Well-formed: b closes inside a -->
<a><b></b></a>

Tip: "Well-formed" only means the syntax is correct. Whether the document also matches a specific schema (the right elements in the right places) is a separate, stricter check called validity.

From Quiz: WEBT / External Webservices | Updated: Jun 23, 2026