So, now.... Woodstox can provide this via Stax (and Stax2) API, with one of overloads of XMLStreamWriter.writeStartDocument() (or similar). The challenge is how to do that via jackson-dataformat-xml; unfortunately there is no clean way to do that yet. Issue that is related is this:
and I was hoping to address this for 2.12, but not sure if I will have time.
Problem is mostly due to huge load of all the work related to Jackson, and the need to figure out specific configurability mechanic to use for this format-specific extension.
Until this configurability option is added, I think there are still 2 potential ways to get it done:
1. Create XMLStreamWriter manually, call `writeStartDocument()` explicitly, pass that to XmlMapper.writeValue(...) (I think there are a few overloads there).
2. Construct basic `Writer` (or `OutputStream`), write XML declaration, pass that to `writeValue()` of XmlMapper or ObjectWriter.
the one concern there, however, is that mapper may try to call `writeStartDocument()` on its own.
Come to think of that, there probably should also be `ToXmlGenerator.Feature.WRITE_START_DOCUMENT` (enabled by default), disabling of which would explicitly prevent XML declaration from being written.
That I should be able to add quite easily as a new Feature in 2.12.
I will create an issue for that.
-+ Tatu +-
--
You received this message because you are subscribed to the Google Groups "Woodstox User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woodstox-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/woodstox-user/0ecb7ade-65f3-458b-8e56-40fc6a18be4fn%40googlegroups.com.