Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at


Summary: This article introduces the 'eXtensible Markup Language' (XML) and tells of it's uses.


XML, 就是 Extensible Markup Language(可扩展标记语言), 是 W3C 推荐参考 通用标记语言. XML 同样也是SGML的子类.

许多语言都是基于XML, 如 XHTML, MathML, SVG, XUL, RSS, 还有 RDF.



HTML 可以归结为以下三个方面:intelligence(智能),maintenance(可维护性),adaptation(适应性)。XML 也有类似的特性:intelligence, adaptation, maintenance, 和simplicity(简洁)。

XML 不同于HTML,HTML 是显示标记,而XML 是通用标记。这两点可以在XSLT中融合在一起。

"Correct" XML

For an XML document to be correct it must be a well-formed document, which conforms to all of XML's syntax rules. Most browsers, including Mozilla offer a debugger that will often tell about non well-formed documents that it will view or read.

XML 示例

There are two different ways that XML can be used for presentation, and this can range from transforming to HTML, to creating PDF or image codes.

One way to have have a style on a XML page is to use CSS with the xml stylesheet declaration.

<?xml-stylesheet type="text/css" href="stylesheet.css"?>

Or with the powerful XSLT, which is capable of transforming XML markup into any number of things, the possibilities are almost endless.

<?xml-stylesheet type="text/xsl" href="transform.xsl"?>





  • 作者: Justin G. Shreve
  • 最终更新时间: 5月19日


 此页面的贡献者: Y001, Mgjbot, Gelihui, Kakurady, Dbseti
 最后编辑者: Y001,