[YANGTOOLS-927] Do not emit empty values in XMLStreamNormalizedNodeStreamWriter Created: 16/Jan/19 Updated: 29/Mar/19 Resolved: 18/Jan/19 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | codecs |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.8 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
When XMLStreamNormalizedNodeStreamWriter is emitting an empty element, we should be using writeEmptyElement() if possible. This requires us to postpone the call to writeStartElement() until we have see the next event. If that event is writeEndElement() and we do not have to emit namespace declaration, we can just use writeEmptyElement(). Same is true for writeElement(), which has an empty or null value. |
| Comments |
| Comment by Robert Varga [ 16/Jan/19 ] |
|
I have prototyped this and state tracking is rather significant. JDK implementation looks like it should handle this, except for the case when we do writeCharacters(""), which forces it to emit the start tag. Woodstox handles this gracefully, as seen in RESTCONF tests, which have Woodstox on the classpath. |
| Comment by Robert Varga [ 16/Jan/19 ] |
|
Actually, no, JDK writer does not do the correct tracking and requires us to do that. |