0
我在將xjb繼承綁定應用於simpleType時遇到了一些麻煩。將它應用到complexType似乎工作正常。JAXB2的繼承插件無法處理simpleTypes
我得到的錯誤是:
compiler was unable to honor this implements customization. It is attached to a wrong place, or its inconsistent with other bindings.
我的綁定是這樣的:
<jaxb:bindings version="1.0"
xmlns:jaxb="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"
jaxb:extensionBindingPrefixes="xjc">
<jaxb:bindings schemaLocation="../xsd/schema.xsd" node="/xs:schema">
<jaxb:bindings multiple="true"
node="//xs:complexType[substring(@name, string-length(@name)-string-length('-e')+1)='-e']">
<inheritance:implements>mypackage.Element</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings multiple="true"
node="//xs:simpleType[descendant::xs:restriction[@base='string']]">
<inheritance:implements>mypackage.Element</inheritance:implements>
</jaxb:bindings>
</jaxb:bindings>
我的XSD包含以下行:
<simpleType name="checkOut">
<restriction base="string"/>
</simpleType>
<simpleType name="checkIn">
<restriction base="string"/>
</simpleType>
<complexType name="Author-e"></complexType>
因此,任何企圖將此插件/修改應用於simpleType失敗。繼承插件不支持simpleType嗎?