我尝试使用 XJC 2.2.4 使用 JAXB2 简化插件。
D:\>xjc -d . -extension -p org.my.space sample.xsd parsing a schema... [ERROR] Unsupported binding namespace
"http://jaxb2-commons.dev.java.net/basic/simplify". Perhaps you meant
"http://jaxb.dev.java.net/plugin/code-injector"? line 7 of file:/D:/sample.xsd
Failed to parse a schema.
sample.xsd 具有声明的简化
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
jaxb:extensionBindingPrefixes="simplify"
xmlns="http://www.example.org/sampleXML" targetNamespace="http://www.example.org/sampleXML"
elementFormDefault="qualified">
有什么想法吗?
编辑:我用绑定文件 xjb 尝试了其他方法,但仍然是同样的错误。这是否意味着我的 XJC 版本(2.2)不支持 JAXB2 简化?
xjc -d 。-extension -b bindings.xjb sample.xsd
<bindings version="2.1"
xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
extensionBindingPrefixes="simplify">
<bindings schemaLocation="sample.xsd" node="/xs:schema">
<bindings
node="/xs:schema/xs:complexType[@name='dlist']/xs:choice/xs:element[1]">
<simplify:as-element-property />
</bindings>
</bindings>
</bindings>