Issue Details (XML | Word | Printable)

Key: WSTX-165
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Tatu Saloranta
Reporter: Tatu Saloranta
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Woodstox

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

Created: 04/Sep/08 08:01 PM   Updated: 22/Nov/08 05:40 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
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.

Ian Brandt added a comment - 07/Nov/08 01:42 PM
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?

Tatu Saloranta added a comment - 07/Nov/08 01:57 PM

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!


Tatu Saloranta added a comment - 17/Nov/08 02:57 PM
Ok will implement this in trunk, and probably backport to 3.2.8 as well.

Tatu Saloranta added a comment - 17/Nov/08 03:29 PM
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.

Tatu Saloranta added a comment - 22/Nov/08 05:40 PM
Included in 3.9.9-1.