2014-01-27 3 views
0

Как использовать привязки jaxb для исправления нескольких ссылок на группы в схеме?FpML 5.3 JAXB Bindings

Часть 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 - grossPrice. Проблема выше, где есть две ссылки на группу 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.

ответ

0

У меня также была эта же проблема, решение заключалось в том, чтобы включить простой режим привязки. Добавьте в свой внешний файл привязок следующее.

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

Ошибка вызвана тем, как JAXB обрабатывает группы, как вы видели себя.