Aalto writes too many xmlns attributes if IS_REPAIRING_NAMESPACES=true
UnasZole opened this issue · 1 comments
Consider the following setup.
- Instantiate an XMLEventReader reading from an xml file, which root element defines an "xmlns" attribute, and contains unprefixed tags. (As an example, you can fetch the W3C's xmldsig schema )
- Instantiate an XMLEventWriter writing on another file, with IS_REPAIRING_NAMESPACES=true.
- For each event read from the Reader, write it through directly to the Writer.
If aalto-xml 1.0.0 is used as STAX backend, the resulting document's root schema tag's xmlns attribute will be written 3 times, as follows :
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.w3.org/2000/09/xmldsig#" version="0.1" elementFormDefault="qualified">
Note that if I simply switch the implementation to woodstox-core 5.0.3, everything works fine, so this is definitely an issue with aalto-xml.
Also note that definitions of prefixed namespaces (like xmlns:xx) are unaffected by the issue : only the "xmlns" attribute is affected.
It would be great to have a small reproduction doing what is suggested; no files are needed (input string via Reader
should work fine, for example). I trust there is a problem.