Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

comments

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> 

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.

like image 722
Jonas Avatar asked May 03 '10 10:05

Jonas


People also ask

How do you comment out tags in XML?

The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags.

How do I comment out a block of XML?

If you want to comment out a single line in the XML code, insert your cursor at the beginning of a line you want to comment out. Type a less-than symbol followed by an exclamation point and two dashes. Move your cursor to the end of the line and then type two dashes followed by a greater-than symbol.

Does XML allow commenting elements?

Allows notes and other human readable comments to be included within an XML file. XML Parsers should ignore XML comments. Some constrains govern where comments may be placed with an XML file.


Video Answer


1 Answers

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> 
like image 140
Noon Silk Avatar answered Sep 28 '22 01:09

Noon Silk