Affects Version/s: 0.9.5.2
Fix Version/s: None
Component/s: XML code generator
Environment:Operating System: other
Number of attachments :
I use the code generator to create Java value classes from xml schema.
When I derive a complex type by restriction, the redefined/repeated content
illegally appears twice in the marshalled xml.
here's an example:
XML output (from marshalling):
– problem details -------------------
First the ctor of MyBaseTypeDescriptor adds all its attributes using
XMLClassDescriptorImpl#addFieldDescriptor, then the ctor of
MyDerivedElementDescriptor does the same again, so that getAttributeDescriptors
() yields everything twice, resulting in an invalid xml doc.
I believe that with restriction of complexTypes, the supertype class should not
add any attribute at all, so that only those attributes are available which are
repeated in the derived class, possibly restricted.
– fix? -------------------
What do you think of having a "clearFieldDescriptors" method in
XMLClassDescriptorImpl? The source generator could insert a call to that method
in the ctor of MyDerivedElementDescriptor.
If you approve to my suggestion or outline some more elegant way to fix the
problem, I'd volunteer to contribute a bugfix.
Thank you very much for your reply!