jsonix
jsonix copied to clipboard
[question] How to add xml declaration to marshalDocument
Hi,
I just started with jsonix in my project. I succesfully created a mapping from an xsd and I am able to create a marshalDocument.
But whether I use marshalString or marshalDocument, there is no xml declaration (eg. <?xml version="1.0" encoding="UTF-8"?>) present in the generated xml.
I've searched github and stackoverflow, but I'm unable to find an answer on how to add a xml declaration using jsonix.
To be honest, I do not know how to do this. Jsonix uses XMLSerializer.serializeToString or node.xml to serialize DOM to string (see Jsonix.DOM.serialize). So I guess XML declaration is not supported yet.
As a workaround you could try to serialize DOM on your own or simply prepend XML declaration to the serialized string.