aalto-xml
aalto-xml copied to clipboard
Validation implementation of `XMLStreamWriter` incomplete
Validation is not working with an XMLStreamWriter. A quick comparison with woodstox makes obvious that several calls to XMLValidator are missing in StreamWriterBase (at least in writeAttribute(...), writeStartElement(...) and _closeStartElement(...)) and subclasses (several locations).
Furthermore, the invocation of XMLValidator..validateElementEnd(...) in StreamWriterBase._validator.validateElementEnd() mixes up the prefix and nsUri arguments.
Correct, it has not (yet) been implemented. But it probably should not be lots of work to complete this, less than work to make reader-side validation work.
Actually only now realized that there is support, just not complete, and obviously not (well) tested. But validator instance is passed; and we can perhaps use Stax2 test suite to help validate validation too...
After brief look, this is not trivial to add. Doable, certainly, but needs to dig in, compare how Woodstox it does (probably), and do it.
Also worth noting that since Aalto itself does not provide validators, nor Stax2 (although a ref impl might make sense?), users would need to write their own validator or use Woodstox-provided implementation. Tests here can do latter.