The code that performs the task is listed below. The key is the XPath expression “//comment()” which selects all the comment nodes in the document. After binding VTDNav object to the XMLModifier object, you can simply call the “remove()” method, which will not only remove the content of the comment, but also the surrounding delimiting text (i.e. <!–, and –>).