Reputation: 460
JAXB generates @XmlAttribute annotations for every attribute. For example, the attribute
<xsd:attribute name="agent_id" use="required" type="xsd:unsignedInt">
<xsd:annotation><xsd:documentation xml:lang="en">Foreign key reference to Agent.agent_id, Included in composite primary key</xsd:documentation></xsd:annotation>
</xsd:attribute>
is translated to the annotated java object attribute
@XmlAttribute(name = "agent_id", required = true)
@XmlSchemaType(name = "unsignedInt")
protected long agentId;
However, if the attribute does not have an underscore in the name, the name field in the @XmlAttribute is missing (and thus ##default). I would like to customize the JAXB binding such, that also annotations for names without underscore are generated. Any suggestions how this could work?
Thanks! Johannes
Upvotes: 1
Views: 376
Reputation: 148977
You could write an XJC plugin to add this behaviour:
As far as a JAXB (JSR-222) implementation is concerned the result XML will be the same.
Upvotes: 1