2

We want to use JAXB to create Java objects from XML files, manipulate them and save them back into XML files. This is not a problem in principle. However, the source XML files contain processing instructions, which are not stored back into the target XML files.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<doc>
    <test>
        <?PITarget1 PIContent2?>
    </test>
</doc>

Is there any way to do this with JAXB? Or is there an alternative to JAXB which can?

Thanks for your help.

Ben
  • 290
  • 2
  • 17
  • Check this topic, I think the answer is there: https://stackoverflow.com/questions/22056085/reading-the-custom-xml-processing-instruction-through-jaxb-unmarshelling – Balázs Nemes Jul 19 '17 at 15:05
  • If I understand the answer correctly, the processing instructions are only output here (system.out.println). How do I get these values ​​in the XML to be written? – Ben Jul 19 '17 at 16:50

0 Answers0