You could do this using Linq by replacing each Note
-node with a new one. Simplified example handling only the first node (tested in Linqpad):
XElement oldStructure =
XElement.Parse(@"<Comment Text=""ABC"">
<Note Timestamp=""3/25/2013 8:26AM!"" Text=""Movie"">
</Note></Comment>");
oldStructure.Dump("Original");
// Replace this with some kind of lookup for each Note-element:
var noteNode = (XElement) oldStructure.FirstNode;
// Create a new node. Note that it has no content:
// (The null could be left out - left it here just to be explicit)
var simplifiedNote = new XElement(noteNode.Name, null);
noteNode.Attributes().ToList().ForEach(
attrib => simplifiedNote.Add(new XAttribute(attrib.Name, attrib.Value)));
// Replace with newly generated node - Linq will automatically use
// the compact format for you here, since the node has no content.
oldStructure.FirstNode.ReplaceWith(simplifiedNote);
oldStructure.Dump("Final");
Running this in Linqpad will first dump the following:
Original:
<Comment Text="ABC">
<Note Timestamp="3/25/2013 8:26AM!" Text="Movie"></Note>
</Comment>
Final:
<Comment Text="ABC">
<Note Timestamp="3/25/2013 8:26AM!" Text="Movie" />
</Comment>