JAXB Binding Unsupported binding namespace "http://www.w3.org/2001/XMLSchema"

2.4k views Asked by At

I have the following XSD which I'm generating JAXB bindings from... (only left relevant portions for this question):

<?xml version="1.0"?>
<xsd:schema 
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
          xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
          jaxb:extensionBindingPrefixes="simplify">...
 <xsd:element name="trace">

     <xsd:annotation>

        <xsd:documentation>
            containing screen navigation data
        </xsd:documentation>

    </xsd:annotation>

    <xsd:complexType>

        <xsd:choice minOccurs ="0" maxOccurs ="unbounded">
            <xsd:element ref="time"  />
            <xsd:element ref="event" />
            <xsd:element ref="location" />
            <xsd:element minOccurs="0" ref="index" ></xsd:element>
            <xsd:element minOccurs="0" ref="caseId"/>
            <xsd:element minOccurs="0" ref="contactAttId" />
            <xsd:element minOccurs="0" ref="action" />
        </xsd:choice>
    </xsd:complexType>
</xsd:element>
1

There are 1 answers

0
Xstian On

You can use below schema

  <xsd:simpleType name="LayerRate_T">
    <xsd:annotation>
       <xsd:appinfo>
          <xjc:javaType name="org.acme.foo.LayerRate"  adapter="org.acme.foo.LayerRateAdapter" />
       </xsd:appinfo>
    </xsd:annotation>
  </xsd:simpleType>

when include binding configuration into your XSD, instead, when you use an external binding is different.

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           jaxb:extensionBindingPrefixes="xjc simplify" jaxb:version="2.1">
    <jaxb:bindings schemaLocation="compass_input_spec_12122014.xsd" node="/xsd:schema">
        <jaxb:bindings node="//xsd:element[@name='trace']/xsd:complexType">
            <simplify:property name="timeOrEventOrLocation">
                <simplify:as-element-property />
            </simplify:property>
        </jaxb:bindings>
    </jaxb:bindings>
</jaxb:bindings>