In the following XML, what is the alternative way to place a comment over the attributes of element?
<!-- I can comment here -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_ben"
<!-- Cannot place a comment here -->
android:layout_centerHorizontal="true"/>
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 --> .
Syntax. A comment starts with <! -- and ends with -->. You can add textual notes as comments between the characters.
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.
No, the string -- is not permitted to appear within comments in XML. So the fact you have -- show up inside another comment is going to cause failures.
No, this isn't possible. Comments are not allowed in an XML open tag.
See How do I comment attributes inside an XML tag?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With