xml serialization and comments
I'm working on some custom xml editor. I have a library that contains all the classes that can be de/serialized. The problem is that during deserialization all the comments that were in the xml are lost. Let's say I have a xml structure:
<mainNode>
<subNode name="firstSubNode">
<item prop1="a" prop2="b"/>
<item prop1="c" prop2="e"/>
<!--Here I have important comment-->
<item prop1="d" prop2="f"/>
</subNode>
<!--and also here I have a comment-->
<subNode name="secondSubNode">
<item prop1="a" prop2="b"/>
<item prop1="c" prop2="e"/>
</subNode>
</mainNode>
Now when I deserialize such xml file I will have a main object (mainNode) that contains two subNodes with items. Now if I serialize this object, the result will be the same file but without comments.
The question: is there a way to keep this comments when running serialize/deseria开发者_JS百科lize method? If yes how will this work when I add/remove/edit some nodes/items that contain comments.
精彩评论