【问题标题】:FpML 5.3 JAXB BindingsFpML 5.3 JAXB 绑定
【发布时间】:2014-01-27 23:00:13
【问题描述】:

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

部分 fpml 5.3 在架构中有以下内容

  <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>

这会导致

     * <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 行是总价格。问题源于上面的价格复杂类型中有 2 组对 EquityPrice.model 的引用。

  <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 的引用。

【问题讨论】:

    标签: jaxb fpml


    【解决方案1】:

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

    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    ...
    <jxb:globalBindings>
        <xjc:simple />
    </jxb:globalBindings>
    

    如您所见,错误是由 JAXB 处理组的方式引起的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      相关资源
      最近更新 更多