Is there a way to read xml comments while parsing it using XStream with Java.
<!--
Mesh: three-dimensional box 100m x 50m x 50m Created By Sumit Purohit on
for a stackoverflow query.
-->
<ParameterList name="Mesh">
<Parameter name="Domain Low Corner" type="Array double" value="{0.0, 0.0, 0.0}" />
<Parameter name="Domain High Corner" type="Array double" value="{100.0, 50.0,50.0}" />
</ParameterList>
I currently use XStream to serialize/ de-serialize kind of xml above. I need to save comments as annotations on my POJO so that i can show it in UI.
I could not find anything in XStream for that.
DOM has DocumentBuilderFactory.setIgnoringComments(boolean) that let you include comments in the DOM tree and you can distinguish between type of Nodes.
Similarly C# has XmlReaderSettings.IgnoreComments