首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FpML 5.3 JAXB绑定

FpML 5.3 JAXB绑定
EN

Stack Overflow用户
提问于 2014-01-27 23:00:13
回答 1查看 599关注 0票数 0

如何使用jaxb绑定来修复架构中的多个组引用?

Fpml5.3的一部分在架构中有以下内容

代码语言:javascript
复制
  <xsd:complexType name="Price">
<xsd:annotation>
  <xsd:documentation xml:lang="en">A type describing the strike price.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
  <xsd:element name="commission" type="Commission" minOccurs="0">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">This optional component specifies the commission to be charged for executing the hedge transactions.</xsd:documentation>
    </xsd:annotation>
  </xsd:element>
  <xsd:choice minOccurs="0">
    <xsd:sequence>
      <xsd:element name="determinationMethod" type="DeterminationMethod">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">Specifies the method according to which an amount or a date is determined.</xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:group ref="EquityPrice.model" minOccurs="0"></xsd:group>
    </xsd:sequence>
    <xsd:element name="amountRelativeTo" type="AmountReference">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">The href attribute value will be a pointer style reference to the element or component elsewhere in the document where the anchor amount is defined.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:group ref="EquityPrice.model"></xsd:group>
  </xsd:choice>
  <xsd:element name="cleanNetPrice" type="xsd:decimal" minOccurs="0">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">The net price excluding accrued interest. The "Dirty Price" for bonds is put in the "netPrice" element, which includes accrued interest. Thus netPrice - cleanNetPrice = accruedInterest. The currency and price expression for this field are the same as those for the (dirty) netPrice.</xsd:documentation>
    </xsd:annotation>
  </xsd:element>
  <xsd:element name="quotationCharacteristics" type="QuotationCharacteristics" minOccurs="0">
    <xsd:annotation>
      <xsd:documentation>Allows information about how the price was quoted to be provided.</xsd:documentation>
    </xsd:annotation>
  </xsd:element>
</xsd:sequence>
  </xsd:complexType>

这会导致

代码语言:javascript
复制
     * <p>
 * You are getting this "catch-all" property because of the following reason: 
 * The field name "GrossPrice" is used by two different parts of a schema. See: 
 * line 1361 of file:/C:/fpml-jaxb/src/main/xsd/fpml-asset-5-3.xsd
 * line 1361 of file:/C:/fpml-jaxb/src/main/xsd/fpml-asset-5-3.xsd
 * <p>

这个错误是误导性的。EquityPrice.model从这个开始,第1361行是grossPrice。这个问题源于上面,在Price类型中,有两个组引用EquityPrice.model。

代码语言:javascript
复制
  <xsd:group name="EquityPrice.model">
<xsd:sequence>
  <xsd:element name="grossPrice" type="ActualPrice" minOccurs="0">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">Specifies the price of the underlyer, before commissions.</xsd:documentation>
    </xsd:annotation>
  </xsd:element>

同样的情况也适用于TradeNovationContent,因为它有多个对NewTrade.model的引用。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-06 08:49:57

我也有同样的问题,解决方案是启用简单的绑定模式。将以下内容添加到外部绑定文件中。

代码语言:javascript
复制
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
...
<jxb:globalBindings>
    <xjc:simple />
</jxb:globalBindings>

正如您自己所看到的,JAXB处理组的方式导致了错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21393514

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档