I need to insert a xml comment XComment
right above each node. It is the same as this question Using XPath to access comments a flat hierachy. What would be the eqivalent of //comment()[following-sibling::*[1][self::attribute]]
in Linq?
A use case for me would be like this:
<root>
<node id="1">
<element>test</element>
</node>
<!-- comment here: TODO: check if ok -->
<node id="2">
<element>is this ok?</element>
</node>
</root>
Sorry, there seems to be a misunderstanding. I have a xml file and need to add a XComment
after I select a node using Linq and lambda expression. That means I load a xml, select a node under root and add XComment.