Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
404 views
in Technique[技术] by (71.8m points)

xml - 如何在XML中注释掉一个标签块?(How do I comment out a block of tags in XML?)

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

(如何在XML中注释掉一个标签块?)

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

(即我如何在下面的代码中注释掉<staticText>及其中的所有内容?)

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

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.

(我可以使用<!-- staticText-->但这只是针对单个标签(就像我所知道的那样),比如//在Java和C中。我想要更像/** comment **/可以用于Java和C,所以我可以注释掉更长的XML代码块。)

  ask by Jonas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

(您可以跨多行使用该样式的注释(也存在于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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...