Is it possible to comment one or several attributes inside an XML tag? Something like /* */
from C.
I have tried using <!-- -->
, but it was unsuccessful.
<element attribute1="value1" attribute2="value2" <!-- attribute3="value3" (commented value) --> >
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 --> .
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.
To add comments in XML file, enclose the comment between `<! -- -->`. Shortcut key is Ctrl+shift+/. To uncomment in XML file, select the line/code which is commented and press Ctlr+shift+\.
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. Depending on your application, you might get away with "commenting out" the attributes by prefixing their names with "_", or you might not (if the XML is validated against a schema or all attributes are parsed). Because whitespace is allowed, and most editors support line operations, you can "comment" multiple attributes easily this way:
<element _attr1="value1" _attr2="value2" _attr3="value3" >
But these attributes are still part of the document.
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