Woodstox

Add writer-property that allows disabling of "auto-closing of unmatched start elements"

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

Just happened to notice this entry from Spring Jira:

http://jira.springframework.org/browse/BATCH-761

and although ideally I would wish that contributors had filed this request themselves, I figured I might as well just add an entry for them.

Seems like a simple thing to implement, safe, and potentially useful for others as well.

Activity

Hide
Tatu Saloranta added a comment -

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.

Show
Tatu Saloranta added a comment - 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.
Hide
Ian Brandt added a comment -

Actually I'd appreciate this feature. I've been meaning to submit a patch for this. Based on http://woodstox.codehaus.org/ConfiguringStreamWriters com.ctc.wstx.api.WstxOutputProperties would be my starting point?

Show
Ian Brandt added a comment - Actually I'd appreciate this feature. I've been meaning to submit a patch for this. Based on http://woodstox.codehaus.org/ConfiguringStreamWriters com.ctc.wstx.api.WstxOutputProperties would be my starting point?
Hide
Tatu Saloranta added a comment -

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.
So let's start with Woodstox-specific one.

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!

Show
Tatu Saloranta added a comment - 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. So let's start with Woodstox-specific one. 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!
Hide
Tatu Saloranta added a comment -

Ok will implement this in trunk, and probably backport to 3.2.8 as well.

Show
Tatu Saloranta added a comment - Ok will implement this in trunk, and probably backport to 3.2.8 as well.
Hide
Tatu Saloranta added a comment -

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.

Show
Tatu Saloranta added a comment - 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.
Hide
Tatu Saloranta added a comment -

Included in 3.9.9-1.

Show
Tatu Saloranta added a comment - Included in 3.9.9-1.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: