我正在尝试通过以下模式对生成的属性进行简单的重命名:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://usermanagement"
targetNamespace="http://usermanagement">
<!-- definitions of complexTypes RoleRef and OrganizationRef omitted -->
<xs:element name="User">
<xs:complexType>
<xs:complexContent>
<xs:extension base="core:RawDTO">
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string" minOccurs="0"/>
<xs:element name="UserId" type="xs:string" minOccurs="0"/>
<xs:element name="Password" type="xs:string" minOccurs="0"/>
<xs:element name="Active" type="xs:boolean" minOccurs="0"/>
<xs:element name="Role" minOccurs="0" maxOccurs="unbounded" type="tns:RoleRef"/>
<xs:element name="Organization" minOccurs="0" maxOccurs="unbounded" type="tns:OrganizationRef"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
使用此绑定:
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="2.1">
<bindings xmlns:tns="http://usermanagement" scd="x-schema::tns">
<!-- Testing simple element match:
<bindings scd="tns:User">
<class name="Uzer"/>
</bindings>
-->
<!-- other attempts:
tns:User/type::0/model::sequence/tns:Role
tns:User/type::0/tns:Role
-->
<bindings scd="tns:User/type::0/content::0/extension::0/model::sequence/tns:Role">
<property name="roles"/>
</bindings>
<schemaBindings>
<package name="com.test.users"/>
</schemaBindings>
</bindings>
</bindings>
问题是我无法使该表达式匹配,并且我发现的SCD示例非常少,并且与 element / complexType / complexContent / extension / sequence < / em>。
我尝试用作灵感的guide仅具有 element / complexType / sequence :/schemaElement::my:chapter/type::0
据我所知,JAXB使用的XSOM编译器并不喜欢指南中的所有表达式类型,例如/type::my:articleType/model::sequence/schemaElement::my:appendix
关于如何使用SCD进行匹配的任何线索?
谢谢