Q:

How to set @XmlType.namespace via JAXB External Bindings Customization file

I am using JAXB to process multiple XML documents.
My issue is that I cannot change the related xsd's and I don't want to amend the generated classes.
What I want to do is employ JAXB Binding customization files to achieve the desired result.
All I need to do is perform the equivalent of using the @XmlType.namespace annotation.
Is it possible to set the @XmlType.namespace annotation via JAXB Binding Customization files?

A:

Disclaimer: I am the author of the jaxb2-annotate-plugin.
You can use the jaxb2-annotate-plugin to add arbitrary annotations to your schema-derived classes. @XmlType will be something like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:annox="http://annox.dev.java.net"
    jaxb:extensionBindingPrefixes="xjc annox"
    version="2.1">

    <jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema">
        <jaxb:bindings node="xs:complexType[@name='someType']">
            <annox:annotateClass>@javax.xml.bind.annotation.XmlType(namespace="urn:test")</annox:annotateClass>
        </jaxb:bindings>
    </jaxb:bindings>

</jaxb:bindings>

If you already have an @XmlType there, the customized annotation will be "merged" into it.

