Creating Java classes from a schema using JaxB with inheritance

I have xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="figures" type="Figures" />

<xsd:complexType name="Figures">
    <xsd:sequence>
        <xsd:element name="figure" type="Figure" />
    </xsd:sequence>
</xsd:complexType>


<xsd:complexType name="Figure">
    <xsd:sequence>
        <xsd:element name="argument" type="xsd:double" />
    </xsd:sequence>
    <xsd:attribute name="name" type="xsd:string" />
    <xsd:attribute name="type" type="xsd:string" />
    <xsd:attribute name="area" type="xsd:string" />
</xsd:complexType>

</xsd:schema>

And this xjb:

<?xml version="1.0"?>
<jxb:bindings version="1.0" 
  xmlns:jxb="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:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
  jxb:extensionBindingPrefixes="xjc">

    <jxb:bindings schemaLocation="FiguresDefinition.xsd">
      <jxb:bindings node="//xs:complexType[@name='Figure']">
        <inheritance:implements>figures.Figure</inheritance:implements> 
      </jxb:bindings>
    </jxb:bindings>

</jxb:bindings>

My idea is to create an abstract abstract drawing and use the argument attribute to create objects.

But when I create the classes, I get:

[ERROR] Unsupported namespace " http://jaxb2-commons.dev.java.net/basic/inheritance ". Did you mean " http://jaxb.dev.java.net/plugin/code-injector "

I don’t know if this is enough enough, but I would like to be able to create objects with a drawing using the name , type , scope and argument specified in XML.

+3

All Articles