They are not part of the document's character data ; an XML processor MAY , but need not, make it possible for an application to retrieve the text of comments. Right, and this is what XML Notepad does for you when you save your document because it also uses XmlWriter which works around the limitations of the XML specification by inserting a space between the two dashes.
But the problem with that algorithm is that it is hard to "undo" this operation if you later want to "uncomment" that text and get back your original value. A typical trick in a C-style program is to use backslash.
XML notepad doesn't do this yet So you would need to encode that also if it could ever show up programatically as something you'd like to save in text nodes.
Probably one of the requirements of the XML language to be simple to implement weighed here and the creators decided not to force implementations to look ahead more than 2 characters in order to be able to make a decision about the next token. Another solution would be that in case you control fully the structure of the xml document, you could just put anyone of your comments within a text node with parent named let's say "comment".
As the "comment element will have no other purpose, it can be conveniently used to contain comments. And I still get the exception on stuff inside of the commented region.
In addition to actual configuration directives, these files can contain comments. To disable the configuration instruction, a is included before its line as well, instructing the computer to ignore the line. To enable one of these configuration instructions, all you have to do is remove the character. To disable any configuration instruction — or add your own comments — just include a at the start of each line.
While this is the format commonly used in configuration files and shell scripts — most notably on Linux and other UNIX-like operating systems — other languages may use other comment formats. Use Google Fonts in Word. Use FaceTime on Android Signal vs. Customize the Taskbar in Windows What Is svchost.
Best Smartwatches. Best Gaming Laptops. Best Smart Displays. Best Home Security Systems. Best External Solid State Drives. Best Portable Chargers. It should work the same after uncommenting in most cases. Delan Azabani Delan Azabani Kuba hasn't forgotten Monica Avijit Karmakar Avijit Karmakar 7, 6 6 gold badges 34 34 silver badges 54 54 bronze badges.
Eric Leschinski k 87 87 gold badges silver badges bronze badges. Comments may appear anywhere in a document. Comments must not appear within attribute values. Comments cannot be nested inside the other comments.
Sumit Sumit 4 4 silver badges 11 11 bronze badges. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
Linked 6. See more linked questions. Related Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back
0コメント