TagName resolution should only be a matter in xml context. IE, we can fully use the modello-plugin-xml attributes and mecanisms, because we should be in xml context (parser, documentation, schema or anything else).
Where is it done?
It should be done in a Utility class, provided by the modello-plugin-xml. As of now, it's done separatly by each plugin, which could lead to very inconsistent behaviour!
- Code snipplet in methods getModelClassDescriptor and writeElementDescriptor in XdocGenerator
- method getTagName in XsdGenerator
- method getTagName in Xpp3ReaderGenerator and code sniplet, somewhere in method writeClass in Xpp3WriterGenerator
How is it done?
The more complete algorithm, for tagName resolution is, according to me:
- if xml.tagName is set, this is our tagName, no question there.
- if the we are not in an association : tagName is the name of the class/field (starting with lower case)
- if we are in an association :
- if xml.associationTagName is set, this is our tagName
- else tagName is the name of the association in singular if xml.listStyle is set to WRAPPED, as given is xml.listStyle is set to FLAT.