我被要求在我的项目中使用FpML,并且很难通过JAXB生成Java类:
[ERROR] Element "{http://www.fpml.org/FpML-5/confirmation}tradeId" shows up in more than one properties.
line 1142 of file:/D:/FpML/schema/fpml/5-5/confirmation/fpml-doc-5-5.xsd
fpml-doc-5.5.xsd被导入到主模式中。
我尝试使用内联自定义绑定(我放弃了使用外部文件),如下所示:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:fpml-annotation="http://www.fpml.org/annotation" targetNamespace="http://www.fpml.org/FpML-5/confirmation" ecore:documentRoot="FpML" ecore:nsPrefix="conf" ecore:package="org.fpml.confirmation" version="$Revision: 10163 $" elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:version="1.0">
....
<xsd:element name="issuer" type="IssuerId"></xsd:element>
<xsd:element name="tradeId" type="TradeId">
<xsd:annotation>
<xsd:appinfo>
<jaxb:property name="tradeIdentifierId"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
仍然出现相同的错误。
直接编辑模式以重命名tradeId可以解决这个问题,但我不能这样做。不过,我仍然可以定义自己的内联绑定。
你能说点什么吗?
发布于 2014-01-17 17:51:41
使用JAXB版本2。我使用的是jaxb-xjc 2.1.13,FPML 5.5确认没有问题。
https://stackoverflow.com/questions/19461933
复制相似问题