|
[
Permalink
| « Hide
]
Tatu Saloranta added a comment - 06/Nov/08 11:54 PM
After thinking about this a bit more, I decided not to go ahead with adding such a feature – after all, it wasn't requested by a user, and while technically speaking it'd be easy enough to add, I'm not sure it is something that should be added. Either way, I'll close this for now and let someone other than the author request addition.
Actually I'd appreciate this feature. I've been meaning to submit a patch for this. Based on http://woodstox.codehaus.org/ConfiguringStreamWriters
Ok, fair enough! Yes, I think adding a property there would be the best way. There is another possibility (adding it to Stax2 properties), but I am not yet convinced this is a feature other implementations would want to adopt. After this it should be easy to follow through the typical usage pattern: there will usually be a bit flag to use in WriterConfig or WstxOutputProperties (see com.ctc.wstx.api and com.ctc.wstx.cfg packages). And then in actual writer check that bit flag before doing automatic closing of such elements. One potential problem/challenge: one has to ensure that the current element is properly closed. That is, writer may only have output something like "<elem" (to allow writing of attributes), so element must be closed with ">". And yes I would definitely appreciate a patch! Ok will implement this in trunk, and probably backport to 3.2.8 as well.
Implemented in trunk (property WstxOutputProperties.P_AUTOMATIC_END_ELEMENTS, defaults to true for backwards compatibility), backported to 3.2 (for 3.2.8 release) as well.
|
||||||||||||||||||||||||||||||||||||||||||||