一个 XML 文档实例 XML 使用简单的具有自我描述性的语法:<?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the meeting!</body> </note> 第一行是 XML 声明。它定义 XML 的版本 (1.0) 和所使用的编码 (ISO-8859-1 = Latin-1/西欧字符集)。下一行描述文档的根元素(像在说:“本文档是一个便签”):<note> 接下来 4 行描述根的 4 个子元素(to, from, heading 以及 body):<to>George</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the meeting!</body> 最后一行定义根元素的结尾:</note>