如何注释掉 XML 中的标记块? [英] How do I comment out a block of tags in XML?

查看:44
本文介绍了如何注释掉 XML 中的标记块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何注释掉 XML 中的标签块?

How do I comment out a block of tags in XML?

即如何在下面的代码中注释掉 及其内部的所有内容?

I.e. How can I comment out <staticText> and everything inside it, in the code below?

  <detail>
    <band height="20">
      <staticText>
        <reportElement x="180" y="0" width="200" height="20"/>
        <text><![CDATA[Hello World!]]></text>
      </staticText>
    </band>
  </detail>

我可以使用 <!-- staticText--> 但这仅适用于单个标签(据我所知),例如 Java 和 C 中的 //. 我想要更像 /** comment **/ 如何在 Java 和 C 中使用的东西,这样我就可以注释掉更长的 XML 代码块.

I could use <!-- staticText--> but that's just for single tags (as what I know), like // in Java and C. I would like something more like how /** comment **/ can be used in Java and C, so I can comment out longer blocks of XML code.

推荐答案

您可以在多行中使用该样式的注释(HTML 中也存在)

You can use that style of comment across multiple lines (which exists also in HTML)

<detail>
    <band height="20">
    <!--
      Hello,
         I am a multi-line XML comment
         <staticText>
            <reportElement x="180" y="0" width="200" height="20"/>
            <text><![CDATA[Hello World!]]></text>
          </staticText>
      -->
     </band>
</detail>

这篇关于如何注释掉 XML 中的标记块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆