Search code examples
xmlexiexificientopenexi

Using EXI: How to preserve comments?


I have tried to encode/decode an XML file using exificient-gui, but the comments contained in the original XML file are not preserved. I have used these settings:

Using Exificient GUI

The resulting XML file (after encode/decode) does not contain the XML comments any longer.

Then I have tried to do the same with OpenExi, with the same result (= no comments).

I have tried the provided Java examples for both Exificient and OpenExi as well; again no comments.

  • What are the correct options for the Exificient (or OpenExi) GUI to preserve the comments?

Solution

  • The short answer is that there was a bug in the EXIficient GUI which has been fixed in the meanwhile. Check out the latest Jar on https://exificient.github.io/java/ and you should just need to set "Preserve Comments".

    The longer answer is that there is a 2 step process for XML/EXI processing here. One aspect is what EXI can preserve. Another aspect is what the XML reader is providing to EXI.

    In this case the XML reader was not properly set to provide Comments. Hence EXIficient could not encode them....