I tried to use JAXB2 simplify plugin using the XJC 2.2.4.
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 has the declared simplify
<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">
any thoughts?
EDIT: I tried other way around with bindings file xjb and still the same error. Does it mean my XJC version(2.2) does not support JAXB2 simplify ?
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>
I switched to
maven jaxb2 plugin
and with some more efforts it worked fine. For people who have trouble in future. This setup works just fine in JDK 1.6 (for those still cant migrate).pom.xml
I did not use
binding.xjb
as I have included thesimplify
directly in the schema (as i have access).sample.xsd