Fix for wrong namespace specification of XML element attribute of derived types #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The title is most probably very confusing and I apologize for that. I will try to explain the issue in the following lines :)
I was using the library for generating classes from BPMN standard xsd files.
However, I have noticed a problem with substitution groups in a circular type dependency scenario, when type defines an element of same owning type which is derived in an external namespace.
The example for this can be seen in BPMNDI.xsd and DI.xsd which specify:
Since BPMNShape (and also BPMNEdge) is a derived type from a different namespace Serialization.XmlElementAttribute for DiagramElement property of Plane class needs to include the namespace where BPMNShape is defined. Currently the namespace of the Plane type is used, which is incorrect.
I have provided a fix and also a test case which checks a very simple BPMN xml file which utilizes these types. The intention was not to test full BPMN spec, since it is a really large standard, but to solve this one problem with XML polymorphism.
Thanks!
PS It might be that such definition of types is not allowed in the XSD standard, but it is used like that in BPMN specification. Let me know if you need more input for the exact source of the problem and further explanations.