O'Reilly logo

Upgrading to PHP 5 by Adam Trachtenberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Well-Formed XML

For an XML document to be considered valid, it must satisfy the following restrictions:

  • The document must have only one top-level element. This element is called the root element.

  • Every element must have both a start and an end tag.

  • All attributes must have values, and those values must be quoted.

  • Elements must not overlap. You cannot use <a><b></a></b>, because the ending </a> tag comes before </b>.

  • You must convert &, <, and > to their entity equivalents. You can use htmlentities( ) to solve this.

When a document meets these rules, it’s valid, or well-formed, XML.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required