如何评论xml标签内的属性? [英] How to comment attribute(s) inside xml tag?
问题描述
是否可以在xml标记中注释一个或多个属性?
像/ * * /。我试过<
不,这是不可能的。 XML开放标记中不允许使用注释。根据您的应用程序,您可能会通过使用_作为其名称前缀注释掉属性,或者您可能不会(如果XML针对模式验证或所有属性都已解析)不会。因为允许使用空格,并且大多数编辑器支持行操作,所以可以通过这种方式轻松注释多个属性:
code>< element
_attr1 =value1
_attr2 =value2
_attr3 =value3
>
但这些属性仍然是文档的一部分。
Is it possible to comment one or several attributes inside xml tag? Something like /* */. I have tried < !-- -- > it was unsuccessful.
No, this isn't possible. Comments are not allowed in an XML open tag. Depending on your application, you might get away with "commenting out" the attributes by prefixing their names with "_", or you might not (if the XML is validated against a schema or all attributes are parsed). Because whitespace is allowed, and most editors support line operations, you can "comment" multiple attributes easily this way:
<element
_attr1="value1"
_attr2="value2"
_attr3="value3"
>
But these attributes are still part of the document.
这篇关于如何评论xml标签内的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!