XML:用注释来操纵代码?
XML: Use comments to manipulate code?
我使用 XML 进行配置,但有时我想测试新的配置并使用注释将它们与其他配置分开,如下所示:
<!-- Begin testing block comments -->
<test1>
something here
</test1>
<test2>
something else
</test>
<!-- End testing block comments -->
所以最近我在评论整个块删除第一个结束评论后遇到了一个错误,假设它作为 C 块评论工作,其中只有第一个评论开始被认为直到找到结束评论(即 /* /* */
).
但是当我执行以下操作时:
<!-- Begin testing block comments >
...
<!-- End testing block comments -->
我仍然遇到配置错误。这会错误评论我的代码还是应该像这样工作?因为如果是的话,我想可能发生了其他事情...
Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.
你这里有这样一个双连字符:
<!-- Begin testing block comments >
...
<!-- End testing block comments -->
^^
我使用 XML 进行配置,但有时我想测试新的配置并使用注释将它们与其他配置分开,如下所示:
<!-- Begin testing block comments -->
<test1>
something here
</test1>
<test2>
something else
</test>
<!-- End testing block comments -->
所以最近我在评论整个块删除第一个结束评论后遇到了一个错误,假设它作为 C 块评论工作,其中只有第一个评论开始被认为直到找到结束评论(即 /* /* */
).
但是当我执行以下操作时:
<!-- Begin testing block comments >
...
<!-- End testing block comments -->
我仍然遇到配置错误。这会错误评论我的代码还是应该像这样工作?因为如果是的话,我想可能发生了其他事情...
Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.
你这里有这样一个双连字符:
<!-- Begin testing block comments >
...
<!-- End testing block comments -->
^^