0

I wish to bind an adapter to any type that has a restriction with base xs:long, how can I achieve this? I wish to do a global binding in a way, but couldn't find any understandable documentation.

<xs:simpleType name="st_type">
<xs:restriction base="xs:long">
    <xs:minInclusive value="0" />
    <xs:maxInclusive value="9999999999" />
</xs:restriction>
</xs:simpleType>

And binding logic below;

<jaxb:bindings schemaLocation="simpleTypes.xsd">
<jaxb:bindings node="xs:simpleType[@base='xs:long']">
    <xjc:javaType name="java.lang.Long"
                   adapter="**.LongAdapter"/>
</jaxb:bindings>
</jaxb:bindings>

I tried the syntax above, but @base is not defined and I have to define for each type that has xs:long as base one by one, is there no way to do a global binding? Thanks.

buræquete
  • 14,226
  • 4
  • 44
  • 89

1 Answers1

0

Awkward to answer my own question but the solution was pretty easy...

<jaxb:globalBindings>
    <xjc:javaType name="java.lang.Long"
            xmlType="xs:long"
            adapter="**.adapters.LongAdapter" />
    <xjc:javaType name="java.lang.Integer"
            xmlType="xs:integer"
            adapter="**.adapters.IntegerAdapter" />
</jaxb:globalBindings>
buræquete
  • 14,226
  • 4
  • 44
  • 89