Affects Version/s: 1.2.12
Fix Version/s: None
Consider the following code:
Both elements are created in the urn:ns1 namespace. An attempt is made to add a namespace declaration that binds the prefix to a different namespace. No error occurs and the output is as follows:
This means that in the serialized document, the namespace of the child element is different than in the object model. This situation (which is expected to be accidental in most cases) will lead to subtle issues later.
Axiom should make sure that the namespaces of element and attribute information items are always preserved and trigger an exception if this constraint is violated by a conflicting namespace declaration.
These checks can be implemented at two levels:
- In the serializer. This is the most robust solution, but makes it more difficult to identify the code that is responsible for the conflicting declaration (because it is only detected later).
- In the declareNamespace and declareDefaultNamespace methods.