问题解决了。
JAXB插件Annotate
http://confluence.highsource.org/display/J2B/Annotate+Plugin完成了这项工作。
在您的jaxb绑定文件(外部绑定,即.xjb文件)中添加以下片段:
<jaxb:bindings schemaLocation="csw/2.0.2/CSW-discovery.xsd" node="/xs:schema"> <jaxb:bindings node="xs:complexType[@name='GetRecordsType']"> <annox:annotate> <annox:annotate annox: name="GetRecordsType" /></annox:annotate> </jaxb:bindings></jaxb:bindings>
不要忘记声明名称空间:
<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:annox="http://annox.dev.java.net" xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" jaxb:extensionBindingPrefixes="xjc annox" version="2.1"> ... </jaxb:bindings>
并使用ANT或MAVEN任务http://confluence.highsource.org/display/J2B/User+Guide进行源代码的生成。
我仍在搜索如何手动指定JAXB扩展名(不使用ant或maven进行xjc任务),但现在可以使用。(我有自己的ANT脚本,这就是为什么我搜索手动调用XJC的原因)。
JAXB扩展机制非常方便,请参阅JAXB2基础:http
://confluence.highsource.org/display/J2B/Home



