JAXB runtime only generates @xsi:type when it is necessary as per the
schema spec. So removing it will probably cause some problems when
someone else tries to read it.
That said, you can probably do so by writing a XMLFilter to remove it
and tell marshaller to write to it.
Johendran, Aravindh wrote:
> Hi,
>
> Thanks for creating and maintaining JAXB. The Java code it generates
> from the xsd is quite cool and overall it is a great tool.
>
> I have a quick question. Is there a way to suppress the xsi:type
> information in the marshaled xml file? JAXB automatically generates type
> info when there is a base class/subclass relationship. It makes sense.
> However, the people who are using the XML file we generate do not want
> the type info. They provided us with the XSD and for that XSD JAXB
> generates the type info at relevant places.
>
>
>
> We are generating some huge xml files and it will be great if the type
> info can be suppressed since it is not being used.
>
>
>
> For example, I'd like to suppress the generation of
> xsi:type="attrString", xsi:type="list" and so on during marshalling.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com