The Rules of XML

The rules for XML documents are simple and few. As another example of an XML document, consider the XML-style English-to-Italian dictionary in Figure 15-5.

A simple XML document

Figure 15-5. A simple XML document

The XML Header

All XML documents start with an XML header like the one in Figure 15-5. XML headers can also include an optional attribute called an encoding, as you can see in the first line of Figure 15-3. This encoding tells an XML processor what kind of characters to expect in the document.

XML Elements

XML elements are used to mark up information. For example, to indicate that something is an English word, we might define an XML element called ...

Get The Book of JavaScript, 2nd 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.