Java has different APIs for parsing XML.
For something like this, I would choose one of the lower-level APIs: DOM, SAX or StAX.
(It won't be easy to get at the comments when you use the higher-level JAXB API).
Here are some good tutorials:
A Guide to XML in Java
The easiest will probably to use the DOM API. Tutorial here:
How to read XML file in Java – (DOM Parser)
The comments will show up as nodes in the DOM tree, just like everything else in the XML.