Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I comment a single line in XML?

This rather is a verification just not to miss out.

Is/n't there a line-comment in XML? So, one without a closer, like "//" the compiler uses.

I saw How do I comment out a block of tags in XML? and several other discussions.

This type of comment would be practical to comment out a line without bothering its closer somewhere down.

like image 402
Roam Avatar asked Sep 26 '22 10:09

Roam


People also ask

How do you put a comment in an XML file?

An XML comment encountered outside the document type declaration is represented by the Comment value syntax element. It contains the comment text from the XML message. If the value of the element contains the character sequence --> , the sequence is replaced with the text --> .

How do you comment out an XML attribute?

< !-- -- > is a valid way to put comments inside an xml file, but it should be placed as a xml node, not a "node attribute" (inside another node tag).

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.


1 Answers

No, there is no way to comment a line in XML and have the comment end automatically on a linebreak.

XML has only one definition for a comment:

'<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

XML forbids -- in comments to maintain compatibility with SGML.

like image 157
kojiro Avatar answered Oct 10 '22 07:10

kojiro