问题
I am using @XmlJavaTypeAdapter to marshal fields of type Map to XML. This results in EclipseLink-MOXy creating an xsi:type="<myValueType>"
-attribute on the output xml-element.
Upon validation the referenced type can of course not be found.
Is there any way of suppressing the generation of this attribute?
PS: An XmlAdapter-tag would be handy :)
回答1:
Turns out the type-attribute had nothing to do with the @XmlJavaTypeAdapter annotation. It was caused by the fact, that the Map's elements were of a derived type and MOXy correctly marshalled their type to a type-attribute.
Using <xml-element-ref>
instead of <xml-element>
solved the issue.
来源:https://stackoverflow.com/questions/8912925/jaxb-elipselink-xmljavatypeadapter-and-the-type-attribute