![xml 单行注释](https://i-blog.csdnimg.cn/blog_migrate/7c0e23298cc0ad449a9e0b8cd1e55cbe.png)
xml 单行注释
XML comments are very useful in order to explain the XML tags. Also if we want to test some XML code with and without we can use comments to enable or disable a single line or XML tag block. XML has similar syntax and terms to the HTML and also comment term is the same.
XML注释对于解释XML标签非常有用。 同样,如果我们要测试是否有XML代码,可以使用注释来启用或禁用单行或XML标记块。 XML具有与HTML相似的语法和术语,注释项也相同。
注释XML块 (Comment XML Block)
As XML is a hierarchical language there may be a lot of tags which are parents and children of others. This named XML tag block. We can command XML tag block which consists of multiple XML tags with the <!-- CODEBLOCK -->
由于XML是一种分层语言,因此可能有很多标记是其他标记的父子。 这个命名的XML标签块。 我们可以使用<!-- CODEBLOCK -->
命令包含多个XML标签的XML标签块<!-- CODEBLOCK -->
We can see in the following example we will comment on the second student which is in red. This means the second student named Ahmet
will not processes by XML processors.
我们可以在下面的示例中看到红色的第二个学生的评论。 这意味着第二名名为Ahmet
学生将不会通过XML处理器进行处理。
<?xml version="1.0" encoding="ISO-8859-15"?>
<class>
<student>
<name>İsmail</name>
<grade>A+</grade>
</student>
<!--
<student>
<name>Ahmet</name>
<grade>A-</grade>
</student>
-->
</class>
评论单行 (Comment Single Line)
We can comment on a single line with the <!-- SINGLELINE -->
. This will only affect the single line and do not comment on upper or lower lines.
我们可以使用<!-- SINGLELINE -->
在单行中进行注释。 这只会影响单行,而不会在高行或低行上发表评论。
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- Student list can be stored here -->
<class>
<student>
<name>İsmail</name>
<grade>A+</grade>
</student>
<student>
<name>Ahmet</name>
<grade>A-</grade>
</student>
</class>
翻译自: https://www.poftut.com/how-to-comment-in-xml-tag-block-or-single-line/
xml 单行注释