Dom 简明教程

DOM - Comment Object

在本章中,我们将学习 Comment 对象。注释作为注释或行添加,用于理解 XML 代码的目的。注释可用于包含相关链接、信息和术语。它们可能出现在 XML 代码的任何位置。

In this chapter, we will study about the Comment object. Comments are added as a notes or the lines for understanding the purpose of an XML code. Comments can be used to include related links, information and terms. These may appear anywhere in the XML code.

注释接口继承表示注释内容的 CharacterData 接口。

The comment interface inherits the CharacterData interface representing the content of the comment.

Syntax

XML 注释具有以下语法 -

XML comment has the following syntax −

<!-------Your comment----->

注释以 <!-- 开头,以 -→ 结尾。您可以在字符之间添加文本注释。您不得在另一个注释里面嵌套一个注释。

A comment starts with <!-- and ends with -→. You can add textual notes as comments between the characters. You must not nest one comment inside the other.