A Complete XML Example

In spite of the freedom that a Web programmer has with XML, certain rules do apply. All XML code must conform to two requirements:

  1. XML code must be well formed and must begin with the <?xml version=1.0?> tag, which is never used in another context. In addition, all tags must appear between the <list> and </list> tags. Browsers do not handle poorly defined XML code as well as they do HTML. If you write badly formed HTML code, such as forgetting a terminating tag before another beginning tag, a browser would not display an error message; instead, the browser would show an incomplete sentence or a badly placed graphic image. When some of the HTML is incorrect, later HTML code is affected. Bad XML code produces actual error ...

Get Absolute Beginner's Guide to Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.