Skip to content

Aalto writes too many xmlns attributes if IS_REPAIRING_NAMESPACES=true #56

@UnasZole

Description

@UnasZole

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    test-neededIssue waiting for reproduction, ideally as stand-alone unit test

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions