FpML Issues Tracker

167: implement choice under Stub construct

March 29, 2006

closed

Crash

Always

Tool Support

evayiin

None

Summary

I need to use floatingRate construct under Stub context type. I've used java, liquid XML 4.2.4 API library, and fpML 4.0 to implement this. However, I am getting the error from Liquid XML engine. I also copy a snippet of java code I wrote to cause this error at the end of the email.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ com.hsbc.cibm.tradecache.feed.summit.exception.SummitParsingException: TradeConverter hit exception: at com.hsbc.cibm.tradecache.feed.summit.xml.TradeConverter.getAsFpml(TradeConverter.java:177) at com.hsbc.cibm.tradecache.feed.summit.SummitXmlToFpmlConverterImpl.processSummitTradeXml(SummitXmlToFpmlConverterImpl.java:125) at com.hsbc.cibm.tradecache.feed.summit.SummitTradeFeedImpl$TradeSpecProcessor.run(SummitTradeFeedImpl.java:474) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Thread.java:534) Caused by: com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [FpML] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [trade] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [SubGrpproduct] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [swap] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [swapStream] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [stubCalculationPeriodAmount] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: Failed to convert the element [initialStub] to XML com.liquid_technologies.ltxmllib4.exceptions.LtValidationException: This element is a choice, and as such must have at one (and only one) valid item, currently there are none set at com.liquid_technologies.ltxmllib4.XmlGeneratedClass.toXml(Unknown Source) at com.liquid_technologies.ltxmllib4.XmlObjectBase.toXml(Unknown Source) at com.hsbc.cibm.tradecache.feed.summit.xml.TradeConverter.getAsFpml(TradeConverter.java:168) ... 4 more

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ the java code which implement this is private StubCalculationPeriodAmount createStubCalculationPeriodAmount() throws LtException, SummitParsingException { if (interestRateStream == null) { interestRateStream = new InterestRateStream(elementName); interestRateStream.setId(legRef); }

StubCalculationPeriodAmount stubCalculationPeriodAmount = new StubCalculationPeriodAmount(); interestRateStream.setStubCalculationPeriodAmount(stubCalculationPeriodAmount);

DateReference calculationPeriodDatesRef = new DateReference("calculationPeriodDatesReference"); calculationPeriodDatesRef.setHref(CALC_PERIOD_DATE_REF + legRef); stubCalculationPeriodAmount.setCalculationPeriodDatesReference(calculationPeriodDatesRef);

if ( summitAssetReader.hasStartStubExplicitDate()) { Stub stub = new Stub("floatingRate");

if (summitAssetReader.getStartStubRateText().doubleValue() != 0 ) stub.setStubRate(summitAssetReader.getStartStubRateText());

stubCalculationPeriodAmount.setInitialStub(stub);

// set STUB_TENOR1, STUB_TENOR2, STUB_INDEX1, STUB_INDEX2 String indexTenorStr = summitAssetReader.getStartStubTerm1Text(); String indexTenorStr2 = summitAssetReader.getStartStubTerm2Text(); if ( indexTenorStr.length() > 0 || indexTenorStr2.length() > 0 ) { IFloatingRateCol ifloatingRateCol = stub.getFloatingRate(); if ( indexTenorStr.length() > 0 ) { FloatingRate floatingRate = new FloatingRate(); floatingRate.setId("floatingRate1"); FloatingRateIndex floatingRateIndex = floatingRate.getFloatingRateIndex();

Interval indexTenor = fpmlHelper.createInterval("indexTenor1", indexTenorStr); indexTenor.setId("indexTenor1"); floatingRate.setIndexTenor(indexTenor);

if ( summitAssetReader.getStartStubSource1Text().length() > 0 ) floatingRateIndex.setFloatingRateIndexScheme(summitAssetReader.getStartStubSource1Text()); ifloatingRateCol.add(floatingRate); }

if ( indexTenorStr2.length() > 0 ) { FloatingRate floatingRate2 = new FloatingRate(); floatingRate2.setId("floatingRate2"); FloatingRateIndex floatingRateIndex2 = floatingRate2.getFloatingRateIndex();

Interval indexTenor2 = fpmlHelper.createInterval("indexTenor2", indexTenorStr2); indexTenor2.setId("indexTenor2"); floatingRate2.setIndexTenor(indexTenor2);

if ( summitAssetReader.getStartStubSource2Text().length() > 0 ) floatingRateIndex2.setFloatingRateIndexScheme(summitAssetReader.getStartStubSource2Text()); ifloatingRateCol.add(floatingRate2); }

} else { // you can specified stub BigDecimal stubRate = summitAssetReader.getStartStubRateText(); if ( stubRate.doubleValue() != 0.0 ) stub.setStubRate(stubRate); } String select = stub.getChoiceSelectedElement(); String tmp = "tmp";

} if ( summitAssetReader.hasEndStubExplicitDate()) { Stub stub = new Stub("floatingRate");

if (summitAssetReader.getEndStubRateText().doubleValue() != 0 ) stub.setStubRate(summitAssetReader.getEndStubRateText());

stubCalculationPeriodAmount.setFinalStub(stub); // only need it for STUB_TERM1 STUB_TERM2 String indexTenorStr = summitAssetReader.getEndStubTerm1Text(); String indexTenorStr2 = summitAssetReader.getEndStubTerm2Text(); if ( indexTenorStr.length() > 0 || indexTenorStr2.length() > 0 ) { IFloatingRateCol ifloatingRateCol = stub.getFloatingRate(); if ( indexTenorStr.length() > 0 ) { FloatingRate floatingRate = new FloatingRate(); floatingRate.setId("floatingRate1"); FloatingRateIndex floatingRateIndex = floatingRate.getFloatingRateIndex();

Interval indexTenor = fpmlHelper.createInterval("indexTenor1", indexTenorStr); indexTenor.setId("indexTenor1"); floatingRate.setIndexTenor(indexTenor);

if ( summitAssetReader.getEndStubTerm1Text().length() > 0 ) floatingRateIndex.setFloatingRateIndexScheme(summitAssetReader.getEndStubTerm1Text()); ifloatingRateCol.add(floatingRate); }

if ( indexTenorStr2.length() > 0 ) { FloatingRate floatingRate2 = new FloatingRate(); floatingRate2.setId("floatingRate2"); FloatingRateIndex floatingRateIndex2 = floatingRate2.getFloatingRateIndex();

Interval indexTenor2 = fpmlHelper.createInterval("indexTenor2", indexTenorStr2); indexTenor2.setId("indexTenor2"); floatingRate2.setIndexTenor(indexTenor2);

if ( summitAssetReader.getEndStubTerm2Text().length() > 0 ) floatingRateIndex2.setFloatingRateIndexScheme(summitAssetReader.getEndStubTerm2Text()); ifloatingRateCol.add(floatingRate2); }

} else { // you can specified stub BigDecimal stubRate = summitAssetReader.getEndStubRateText(); if ( stubRate.doubleValue() != 0.0 ) stub.setStubRate(stubRate); } String select = stub.getChoiceSelectedElement(); String tmp = "tmp";

}

return stubCalculationPeriodAmount; }

Notes:

  • mgratacos

    04/03/06 5:21 pm

    The schema structure is correct. It’s a problem with the tool or the code.

  • mgratacos

    05/19/06 4:38 pm

    We are not able to find anyone with experience with this tool in the FpML community to solve the issue. The schema is correct. It’s not an FpML issue.

  • Leave an update

    You must be logged in to post an update.