Imagine you’re using an XML parser to read in files, editing them, and then using an XML formatter to write the files, and that the XML style <!– comments –> are not preserved. If the editing process preserves all elements and attributes, however, even those that are not expected, then that might be exploited to provide custom comments.
Thus, rather than writing this:
<element field="value"> <!-- comment text --> </element>
you could write this:
<element field="value"> <comment>comment text</comment> </element>
<element comment="comment text" field="value"/>
Furthermore, note that if the order of sibling elements is not preserved (perhaps the elements are being deliberately sorted), then the comment will have to be a child (not a sibling) of the associated element.