问题描述
我正在使用xjc从XSD架构生成java类。我的问题是关于以下XSD代码段的:
<xsd:complexType name="JurisdictionCountry_BvType">
<xsd:sequence>
<xsd:element name="id" type="JurisdictionCountry_ENUM_List" minOccurs="1"/>
<xsd:element name="code" type="JurisdictionCountry_CODE_List" minOccurs="0"/>
<xsd:element name="value" type="JurisdictionCountry_VALUE_List" minOccurs="0"/>
</xsd:sequence>
<xsd:complexType>
<xsd:simpleType name="JurisdictionCountry_ENUM_List">
<xsd:restriction base="xsd:long">
<xsd:enumeration value="0"/>
.....
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="JurisdictionCountry_CODE_List">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="0"/>
....
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="JurisdictionCountry_VALUE_List">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="-Select-"/>
.....
</xsd:restriction>
</xsd:simpleType>
为JurisdictionCountry_BvType生成的java类如下:
@XmlAccessorType(XmlAccesstype.FIELD)
@XmlType(name = "JurisdictionCountry_BvType",propOrder = {
"id","code","value"
})
public class JurisdictionCountryBvType {
protected long id;
protected String code;
@XmlSchemaType(name = "string")
protected JurisdictionCountryVALUEList value;
}
我遇到两个问题:
具有类似设置(id和代码变量)的其他元素也会发生相同的情况。我不确定这是否是架构本身的问题?或者是其他东西。该架构由主架构中包含的多个架构文件组成。我以为可能是xsd:restriction,但是JurisdictionCountry_VALUE_List类型具有并且已正确生成。任何帮助/指针将不胜感激。
谢谢。
编辑:我在ext_bindings.jxb中添加了以下内容:
这导致生成了JurisdictionCountry_ENUM_List和JurisdictionCountry_CODE_List的java类,但是它们没有来自xsd:enumeration元素的任何值。
@XmlAccessorType(XmlAccesstype.PROPERTY)
@XmlType(name = "JurisdictionState_ENUM_List",propOrder = {
"value"
})
public class JurisdictionStateENUMList {
@XmlValue
protected long value;
public long getValue() {
return value;
}
public void setValue(long value) {
this.value = value;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)