FpML® 5.0 XML Data Binding  - Nuget packge LiquidTechnologies.XmlObjects.FpML5-0 FpML® 5.0 XML Data Binding - Nuget packge LiquidTechnologies.XmlObjects.FpML5-0

Home > XML Data Binding Nuget Packages > FpML® 5.0

 

Financial products Markup Language (FpML®)

FpML® (Financial products Markup Language) is the industry-standard protocol for complex financial products. It is based on XML (eXtensible Markup Language), the standard meta-language for describing data shared between applications.

NuGet Package ID LiquidTechnologies.XmlObjects.FpML5-0
Description An object model for the FpML® 5.0 standard providing strongly typed classes that can be serialized/deserializsed to XML.
Documentation Liquid XML Objects API
Schema Documentation https://schemas.liquid-technologies.com/FpML/5.0/
Official Schema Site http://www.fpml.org/
License EULA
Supported Platforms
  • .Net Standard 2.0 and above
  • .Net Core 2.0 and above
  • .Net Framework 4.0 and above

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var requestConfirmationElm = new Tns.RequestConfirmationElm();
            {
                var trade = new Tns.TradeCt();
                var partyTradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers.PartyReference.Href = "Party1";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.PartyA.com/coding-scheme/trade-id";
                        tradeIds.Value = "Trade234";
                        partyTradeIdentifiers.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers);
                }
                trade.TradeHeader.TradeDate.Id = "TRADEDATE";
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2006, 5, 10, 0, 0, 0, 0, 0, 0, -5, 0);
                {
                    var product = new Tns.BondOptionElm();
                    {
                        var price = new Tns.OptionStrikeCt();
                        price.StrikePrice = BigDecimal.Parse("99.7");
                        product.Strike.Price = price;
                    }
                    {
                        var bond = new Tns.BondCt();
                        bond.CouponRate = BigDecimal.Parse("0.014");
                        bond.Maturity = new LxDateTime(LxDateTimeType.Date, 2011, 3, 20, 0, 0, 0, 0, 0, 0, -5, 0);
                        bond.ParValue = BigDecimal.Parse("10000000000");
                        bond.FaceAmount = BigDecimal.Parse("10000000000");
                        {
                            var currency = new Tns.IdentifiedCurrencyCt();
                            currency.Value = "JPY";
                            bond.Currency = currency;
                        }
                        {
                            var clearanceSystem = new Tns.ClearanceSystemCt();
                            clearanceSystem.Value = "Clearstream";
                            bond.ClearanceSystem = clearanceSystem;
                        }
                        var instrumentIds = new Tns.InstrumentIdCt();
                        {
                            instrumentIds.InstrumentIdScheme = "CUSIP";
                            instrumentIds.Value = "ExampleCUSIP1";
                            bond.InstrumentIds.Add(instrumentIds);
                        }
                        product.Bond = bond;
                    }
                    {
                        var premium = new Tns.PremiumCt();
                        premium.PremiumType = Tns.PremiumTypeEnumEnum.Fixed_;
                        premium.PayerPartyReference.Href = "Party1";
                        premium.ReceiverPartyReference.Href = "Party2";
                        premium.PaymentAmount.Amount = BigDecimal.Parse("25000000");
                        premium.PaymentAmount.Currency.Value = "JPY";
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2006, 5, 15, 0, 0, 0, 0, 0, 0, -5, 0);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                var businessCenters1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters1.Value = "JPTO";
                                    businessCenters.BusinessCenters.Add(businessCenters1);
                                }
                                adjustableDate.DateAdjustments.BusinessCenters = businessCenters;
                            }
                            premium.PaymentDate.AdjustableDate = adjustableDate;
                        }
                        product.Premium = premium;
                    }
                    {
                        var exercise = new Tns.EuropeanExerciseElm();
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2006, 6, 19, 0, 0, 0, 0, 0, 0, -5, 0);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                var businessCenters1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters1.Value = "JPTO";
                                    businessCenters.BusinessCenters.Add(businessCenters1);
                                }
                                adjustableDate.DateAdjustments.BusinessCenters = businessCenters;
                            }
                            exercise.ExpirationDate.AdjustableDate = adjustableDate;
                        }
                        exercise.EarliestExerciseTime.HourMinuteTime = new LxDateTime(LxDateTimeType.Time, 0, 0, 0, 9, 0, 0, 0, 0, 0, false);
                        exercise.EarliestExerciseTime.BusinessCenter.Value = "JPTO";
                        exercise.ExpirationTime.HourMinuteTime = new LxDateTime(LxDateTimeType.Time, 0, 0, 0, 14, 30, 0, 0, 0, 0, false);
                        exercise.ExpirationTime.BusinessCenter.Value = "JPTO";
                        product.Exercise = exercise;
                    }
                    {
                        var manualExercise = new Tns.ManualExerciseCt();
                        {
                            var exerciseNotice = new Tns.ExerciseNoticeCt();
                            exerciseNotice.PartyReference.Href = "Party1";
                            exerciseNotice.BusinessCenter.Value = "JPTO";
                            manualExercise.ExerciseNotice = exerciseNotice;
                        }
                        product.ExerciseProcedure.ManualExercise = manualExercise;
                    }
                    product.ExerciseProcedure.FollowUpConfirmation = true;
                    product.ExerciseProcedure.LimitedRightToConfirm = false;
                    product.ExerciseProcedure.SplitTicket = false;
                    {
                        var notionalAmount = new Tns.MoneyCt();
                        notionalAmount.Amount = BigDecimal.Parse("10000000000");
                        notionalAmount.Currency.Value = "JPY";
                        product.NotionalAmount = notionalAmount;
                    }
                    product.OptionEntitlement = BigDecimal.Parse("10000000000");
                    {
                        var entitlementCurrency = new Tns.CurrencyCt();
                        entitlementCurrency.Value = "JPY";
                        product.EntitlementCurrency = entitlementCurrency;
                    }
                    product.NumberOfOptions = BigDecimal.Parse("1");
                    product.SettlementType = new Ns.SettlementTypeEnumUnion(Tns.CashPhysicalEnumEnum.Physical);
                    {
                        var settlementDate = new Tns.AdjustableOrRelativeDateCt();
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2006, 6, 22, 0, 0, 0, 0, 0, 0, -5, 0);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                var businessCenters1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters1.Value = "JPTO";
                                    businessCenters.BusinessCenters.Add(businessCenters1);
                                }
                                adjustableDate.DateAdjustments.BusinessCenters = businessCenters;
                            }
                            settlementDate.AdjustableDate = adjustableDate;
                        }
                        product.SettlementDate = settlementDate;
                    }
                    product.BuyerPartyReference.Href = "Party1";
                    product.SellerPartyReference.Href = "Party2";
                    product.OptionType = new Ns.OptionTypeEnumUnion(Tns.PutCallEnumEnum.Call);
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReferences = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReferences.Href = "Party1";
                        calculationAgent.CalculationAgentPartyReferences.Add(calculationAgentPartyReferences);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                requestConfirmationElm.Trade = trade;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "Party1";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party A";
                    parties.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "Party2";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party B";
                    parties1.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties1);
            }
            requestConfirmationElm.IsCorrection = false;
            requestConfirmationElm.CorrelationId.CorrelationIdScheme = "http://www.example.com/conversationId";
            requestConfirmationElm.CorrelationId.Value = "CRR/2007/01/04/2342342";
            requestConfirmationElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            requestConfirmationElm.Header.SentBy.Value = "PARTYABIC1";
            var sendTos = new Tns.MessageAddressCt();
            {
                sendTos.Value = "ABC";
                requestConfirmationElm.Header.SendTos.Add(sendTos);
            }
            requestConfirmationElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2007, 1, 5, 15, 38, 0, 0, 0, 0, -5, 0);
            requestConfirmationElm.Header.MessageId.MessageIdScheme = "http://www.partyA.com/coding-scheme/message-id";
            requestConfirmationElm.Header.MessageId.Value = "2342342";
            requestConfirmationElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.RequestConfirmationElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, requestConfirmationElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
        == Copyright (c) 2002-2010. All rights reserved.
        == Financial Products Markup Language is subject to the FpML public license.
        == A copy of this license is available at http://www.fpml.org/license/license.html
-->
<requestConfirmation xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
    <messageId messageIdScheme="http://www.partyA.com/coding-scheme/message-id">2342342</messageId>
    <sentBy>PARTYABIC1</sentBy>
    <sendTo>ABC</sendTo>
    <creationTimestamp>2007-01-05T15:38:00-05:00</creationTimestamp>
  </header>
<!--5.0 Messaging: added
                <isCorrection>
                <correlationId>
                <sequenceNumber>
        -->
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.example.com/conversationId">CRR/2007/01/04/2342342</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="Party1" />
        <tradeId tradeIdScheme="http://www.PartyA.com/coding-scheme/trade-id">Trade234</tradeId>
      </partyTradeIdentifier>
      <tradeDate id="TRADEDATE">2006-05-10-05:00</tradeDate>
    </tradeHeader>
    <bondOption>
      <buyerPartyReference href="Party1" />
      <sellerPartyReference href="Party2" />
      <optionType>Call</optionType>
      <premium>
        <payerPartyReference href="Party1" />
        <receiverPartyReference href="Party2" />
        <paymentAmount>
          <currency>JPY</currency>
          <amount>25000000</amount>
        </paymentAmount>
        <paymentDate>
          <adjustableDate>
            <unadjustedDate>2006-05-15-05:00</unadjustedDate>
            <dateAdjustments>
              <businessDayConvention>FOLLOWING</businessDayConvention>
              <businessCenters>
                <businessCenter>JPTO</businessCenter>
              </businessCenters>
            </dateAdjustments>
          </adjustableDate>
        </paymentDate>
        <premiumType>Fixed</premiumType>
      </premium>
      <europeanExercise>
        <expirationDate>
          <adjustableDate>
            <unadjustedDate>2006-06-19-05:00</unadjustedDate>
            <dateAdjustments>
              <businessDayConvention>FOLLOWING</businessDayConvention>
              <businessCenters>
                <businessCenter>JPTO</businessCenter>
              </businessCenters>
            </dateAdjustments>
          </adjustableDate>
        </expirationDate>
        <earliestExerciseTime>
          <hourMinuteTime>09:00:00</hourMinuteTime>
          <businessCenter>JPTO</businessCenter>
        </earliestExerciseTime>
        <expirationTime>
          <hourMinuteTime>14:30:00</hourMinuteTime>
          <businessCenter>JPTO</businessCenter>
        </expirationTime>
      </europeanExercise>
      <exerciseProcedure>
        <manualExercise>
          <exerciseNotice>
            <partyReference href="Party1" />
            <businessCenter>JPTO</businessCenter>
          </exerciseNotice>
        </manualExercise>
        <followUpConfirmation>true</followUpConfirmation>
        <limitedRightToConfirm>false</limitedRightToConfirm>
        <splitTicket>false</splitTicket>
      </exerciseProcedure>
      <notionalAmount>
        <currency>JPY</currency>
        <amount>10000000000</amount>
      </notionalAmount>
      <optionEntitlement>10000000000</optionEntitlement>
      <entitlementCurrency>JPY</entitlementCurrency>
      <numberOfOptions>1</numberOfOptions>
      <settlementType>Physical</settlementType>
      <settlementDate>
        <adjustableDate>
          <unadjustedDate>2006-06-22-05:00</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCenters>
              <businessCenter>JPTO</businessCenter>
            </businessCenters>
          </dateAdjustments>
        </adjustableDate>
      </settlementDate>
      <strike>
        <price>
          <strikePrice>99.7</strikePrice>
        </price>
      </strike>
      <bond>
        <instrumentId instrumentIdScheme="CUSIP">ExampleCUSIP1</instrumentId>
        <currency>JPY</currency>
        <clearanceSystem>Clearstream</clearanceSystem>
        <couponRate>0.014</couponRate>
        <maturity>2011-03-20-05:00</maturity>
        <parValue>10000000000</parValue>
        <faceAmount>10000000000</faceAmount>
      </bond>
    </bondOption>
    <calculationAgent>
      <calculationAgentPartyReference href="Party1" />
    </calculationAgent>
  </trade>
  <party id="Party1">
    <partyId>Party A</partyId>
  </party>
  <party id="Party2">
    <partyId>Party B</partyId>
  </party>
</requestConfirmation>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var confirmationAgreedElm = new Tns.ConfirmationAgreedElm();
            {
                var trade = new Tns.TradeCt();
                var partyTradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers.PartyReference.Href = "kom722";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.partyA.com/eqs-trade-id";
                        tradeIds.Value = "1734";
                        partyTradeIdentifiers.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers);
                }
                var partyTradeIdentifiers1 = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers1.PartyReference.Href = "kow029";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.partyB.com/eqs-trade-id";
                        tradeIds.Value = "5648";
                        partyTradeIdentifiers1.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers1);
                }
                trade.TradeHeader.TradeDate.Id = "TradeDate";
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2002, 7, 19, 0, 0, 0, 0, 0, 0, true);
                {
                    var product = new Tns.DividendSwapTransactionSupplementElm();
                    product.DividendLeg.DeclaredCashDividendPercentage = BigDecimal.Parse("1");
                    product.DividendLeg.DeclaredCashEquivalentDividendPercentage = BigDecimal.Parse("1");
                    var dividendPeriods = new Tns.DividendPeriodPaymentCt();
                    {
                        dividendPeriods.FixedStrike = BigDecimal.Parse("0.045");
                        dividendPeriods.PaymentDate.Id = "p1";
                        {
                            var relativeDate = new Tns.RelativeDateOffsetCt();
                            relativeDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            relativeDate.DateRelativeTo.Href = "e1";
                            relativeDate.DayType = Tns.DayTypeEnumEnum.Calendar;
                            relativeDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            relativeDate.Period = Tns.PeriodEnumEnum.D;
                            dividendPeriods.PaymentDate.RelativeDate = relativeDate;
                        }
                        dividendPeriods.Id = "d1";
                        dividendPeriods.UnadjustedStartDate.Value = new LxDateTime(LxDateTimeType.Date, 2010, 12, 20, 0, 0, 0, 0, 0, 0, true);
                        dividendPeriods.UnadjustedEndDate.Id = "e1";
                        dividendPeriods.UnadjustedEndDate.Value = new LxDateTime(LxDateTimeType.Date, 2011, 12, 19, 0, 0, 0, 0, 0, 0, true);
                        dividendPeriods.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                        {
                            var businessCenters = new Tns.BusinessCentersCt();
                            var businessCenters1 = new Tns.BusinessCenterCt();
                            {
                                businessCenters1.Value = "EUTA";
                                businessCenters.BusinessCenters.Add(businessCenters1);
                            }
                            dividendPeriods.DateAdjustments.BusinessCenters = businessCenters;
                        }
                        product.DividendLeg.DividendPeriods.Add(dividendPeriods);
                    }
                    var dividendPeriods1 = new Tns.DividendPeriodPaymentCt();
                    {
                        dividendPeriods1.FixedStrike = BigDecimal.Parse("0.045");
                        dividendPeriods1.PaymentDate.Id = "p2";
                        {
                            var relativeDate = new Tns.RelativeDateOffsetCt();
                            relativeDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            relativeDate.DateRelativeTo.Href = "e2";
                            relativeDate.DayType = Tns.DayTypeEnumEnum.Calendar;
                            relativeDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            relativeDate.Period = Tns.PeriodEnumEnum.D;
                            dividendPeriods1.PaymentDate.RelativeDate = relativeDate;
                        }
                        dividendPeriods1.Id = "d2";
                        dividendPeriods1.UnadjustedStartDate.Value = new LxDateTime(LxDateTimeType.Date, 2011, 12, 20, 0, 0, 0, 0, 0, 0, true);
                        dividendPeriods1.UnadjustedEndDate.Id = "e2";
                        dividendPeriods1.UnadjustedEndDate.Value = new LxDateTime(LxDateTimeType.Date, 2012, 12, 19, 0, 0, 0, 0, 0, 0, true);
                        dividendPeriods1.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                        {
                            var businessCenters = new Tns.BusinessCentersCt();
                            var businessCenters1 = new Tns.BusinessCenterCt();
                            {
                                businessCenters1.Value = "EUTA";
                                businessCenters.BusinessCenters.Add(businessCenters1);
                            }
                            dividendPeriods1.DateAdjustments.BusinessCenters = businessCenters;
                        }
                        product.DividendLeg.DividendPeriods.Add(dividendPeriods1);
                    }
                    {
                        var singleUnderlyer = new Tns.SingleUnderlyerCt();
                        {
                            var underlyingAsset = new Tns.IndexElm();
                            var relatedExchangeIds = new Tns.ExchangeIdCt();
                            {
                                relatedExchangeIds.Value = "MATIF";
                                underlyingAsset.RelatedExchangeIds.Add(relatedExchangeIds);
                            }
                            var relatedExchangeIds1 = new Tns.ExchangeIdCt();
                            {
                                relatedExchangeIds1.Value = "MONEP";
                                underlyingAsset.RelatedExchangeIds.Add(relatedExchangeIds1);
                            }
                            {
                                var currency = new Tns.IdentifiedCurrencyCt();
                                currency.Value = "EUR";
                                underlyingAsset.Currency = currency;
                            }
                            {
                                var exchangeId = new Tns.ExchangeIdCt();
                                exchangeId.Value = "EuroNext";
                                underlyingAsset.ExchangeId = exchangeId;
                            }
                            var instrumentIds = new Tns.InstrumentIdCt();
                            {
                                instrumentIds.InstrumentIdScheme = "http://example.com/instrumentId";
                                instrumentIds.Value = ".FCHI";
                                underlyingAsset.InstrumentIds.Add(instrumentIds);
                            }
                            underlyingAsset.Description = "France CAC 40 Index";
                            singleUnderlyer.UnderlyingAsset = underlyingAsset;
                        }
                        singleUnderlyer.OpenUnits = BigDecimal.Parse("1000");
                        product.DividendLeg.Underlyer.SingleUnderlyer = singleUnderlyer;
                    }
                    product.DividendLeg.SettlementType = new Ns.SettlementTypeEnumUnion(Tns.CashPhysicalEnumEnum.Cash);
                    {
                        var settlementCurrency = new Tns.CurrencyCt();
                        settlementCurrency.Value = "USD";
                        product.DividendLeg.SettlementCurrency = settlementCurrency;
                    }
                    product.DividendLeg.PayerPartyReference.Href = "kom722";
                    product.DividendLeg.ReceiverPartyReference.Href = "kow029";
                    var fixedPayments = new Tns.FixedPaymentAmountCt();
                    {
                        {
                            var paymentAmount = new Tns.NonNegativeMoneyCt();
                            paymentAmount.Amount = BigDecimal.Parse("50000");
                            paymentAmount.Currency.Value = "USD";
                            fixedPayments.PaymentAmount = paymentAmount;
                        }
                        fixedPayments.PaymentDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                        fixedPayments.PaymentDate.DateRelativeTo.Href = "p1";
                        fixedPayments.PaymentDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("0");
                        fixedPayments.PaymentDate.Period = Tns.PeriodEnumEnum.D;
                        product.FixedLeg.FixedPayments.Add(fixedPayments);
                    }
                    var fixedPayments1 = new Tns.FixedPaymentAmountCt();
                    {
                        {
                            var paymentAmount = new Tns.NonNegativeMoneyCt();
                            paymentAmount.Amount = BigDecimal.Parse("56000");
                            paymentAmount.Currency.Value = "USD";
                            fixedPayments1.PaymentAmount = paymentAmount;
                        }
                        fixedPayments1.PaymentDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                        fixedPayments1.PaymentDate.DateRelativeTo.Href = "p1";
                        fixedPayments1.PaymentDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("0");
                        fixedPayments1.PaymentDate.Period = Tns.PeriodEnumEnum.D;
                        product.FixedLeg.FixedPayments.Add(fixedPayments1);
                    }
                    product.FixedLeg.PayerPartyReference.Href = "kow029";
                    product.FixedLeg.ReceiverPartyReference.Href = "kom722";
                    trade.Product = product;
                }
                confirmationAgreedElm.Trade = trade;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "kom722";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party A";
                    parties.PartyIds.Add(partyIds);
                }
                confirmationAgreedElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "kow029";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party B";
                    parties1.PartyIds.Add(partyIds);
                }
                confirmationAgreedElm.Parties.Add(parties1);
            }
            confirmationAgreedElm.Header.InReplyTo.MessageIdScheme = "http://www.example.com/messageId";
            confirmationAgreedElm.Header.InReplyTo.Value = "MS/2006/04/07/15-99";
            confirmationAgreedElm.Header.SentBy.Value = "PARTYABICXXX";
            var sendTos = new Tns.MessageAddressCt();
            {
                sendTos.Value = "PARTYBBICXXX";
                confirmationAgreedElm.Header.SendTos.Add(sendTos);
            }
            confirmationAgreedElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2006, 7, 2, 16, 38, 0, 0, 0, 0, true);
            confirmationAgreedElm.Header.MessageId.MessageIdScheme = "http://www.example.com/messageId";
            confirmationAgreedElm.Header.MessageId.Value = "MS/2006/07/04/15-99";
            confirmationAgreedElm.CorrelationId.CorrelationIdScheme = "http://www.example.com/conversationId";
            confirmationAgreedElm.CorrelationId.Value = "CW/2006/07/02/123";
            confirmationAgreedElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            confirmationAgreedElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.ConfirmationAgreedElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, confirmationAgreedElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
   == Copyright (c) 2002-2010. All rights reserved.
   == Financial Products Markup Language is subject to the FpML public license.
   == A copy of this license is available at http://www.fpml.org/license/license.html
-->
<!--5.0:Message type is a Root of the message-->
<!--5.0 Messaging: changed <tradeConfirmed> -><confirmationAgreed>-->
<confirmationAgreed xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
    <messageId messageIdScheme="http://www.example.com/messageId">MS/2006/07/04/15-99</messageId>
    <inReplyTo messageIdScheme="http://www.example.com/messageId">MS/2006/04/07/15-99</inReplyTo>
    <sentBy>PARTYABICXXX</sentBy>
    <sendTo>PARTYBBICXXX</sendTo>
    <creationTimestamp>2006-07-02T16:38:00Z</creationTimestamp>
  </header>
<!--5.0 Messaging: added
                <correlationId>
                <sequenceNumber>
        -->
  <correlationId correlationIdScheme="http://www.example.com/conversationId">CW/2006/07/02/123</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="kom722" />
        <tradeId tradeIdScheme="http://www.partyA.com/eqs-trade-id">1734</tradeId>
      </partyTradeIdentifier>
      <partyTradeIdentifier>
        <partyReference href="kow029" />
        <tradeId tradeIdScheme="http://www.partyB.com/eqs-trade-id">5648</tradeId>
      </partyTradeIdentifier>
      <tradeDate id="TradeDate">2002-07-19Z</tradeDate>
    </tradeHeader>
<!-- as per final dividend index swap master confirm ISDA -->
    <dividendSwapTransactionSupplement>
      <dividendLeg>
        <payerPartyReference href="kom722" />
        <receiverPartyReference href="kow029" />
        <underlyer>
          <singleUnderlyer>
            <index>
              <instrumentId instrumentIdScheme="http://example.com/instrumentId">.FCHI</instrumentId>
              <description>France CAC 40 Index</description>
              <currency>EUR</currency>
              <exchangeId>EuroNext</exchangeId>
              <relatedExchangeId>MATIF</relatedExchangeId>
              <relatedExchangeId>MONEP</relatedExchangeId>
            </index>
            <openUnits>1000</openUnits>
          </singleUnderlyer>
        </underlyer>
        <settlementType>Cash</settlementType>
        <settlementCurrency>USD</settlementCurrency>
        <declaredCashDividendPercentage>1.0</declaredCashDividendPercentage>
        <declaredCashEquivalentDividendPercentage>1.0</declaredCashEquivalentDividendPercentage>
        <dividendPeriod id="d1">
          <unadjustedStartDate>2010-12-20Z</unadjustedStartDate>
          <unadjustedEndDate id="e1">2011-12-19Z</unadjustedEndDate>
          <dateAdjustments>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCenters>
              <businessCenter>EUTA</businessCenter>
            </businessCenters>
          </dateAdjustments>
          <fixedStrike>0.045</fixedStrike>
          <paymentDate id="p1">
            <relativeDate>
              <periodMultiplier>3</periodMultiplier>
              <period>D</period>
              <dayType>Calendar</dayType>
              <businessDayConvention>FOLLOWING</businessDayConvention>
              <dateRelativeTo href="e1" />
            </relativeDate>
          </paymentDate>
        </dividendPeriod>
        <dividendPeriod id="d2">
          <unadjustedStartDate>2011-12-20Z</unadjustedStartDate>
          <unadjustedEndDate id="e2">2012-12-19Z</unadjustedEndDate>
          <dateAdjustments>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCenters>
              <businessCenter>EUTA</businessCenter>
            </businessCenters>
          </dateAdjustments>
          <fixedStrike>0.045</fixedStrike>
          <paymentDate id="p2">
            <relativeDate>
              <periodMultiplier>3</periodMultiplier>
              <period>D</period>
              <dayType>Calendar</dayType>
              <businessDayConvention>FOLLOWING</businessDayConvention>
              <dateRelativeTo href="e2" />
            </relativeDate>
          </paymentDate>
        </dividendPeriod>
      </dividendLeg>
      <fixedLeg>
        <payerPartyReference href="kow029" />
        <receiverPartyReference href="kom722" />
        <fixedPayment>
          <paymentAmount>
            <currency>USD</currency>
            <amount>50000</amount>
          </paymentAmount>
          <paymentDate>
            <periodMultiplier>0</periodMultiplier>
            <period>D</period>
            <businessDayConvention>NONE</businessDayConvention>
            <dateRelativeTo href="p1" />
          </paymentDate>
        </fixedPayment>
        <fixedPayment>
          <paymentAmount>
            <currency>USD</currency>
            <amount>56000</amount>
          </paymentAmount>
          <paymentDate>
            <periodMultiplier>0</periodMultiplier>
            <period>D</period>
            <businessDayConvention>NONE</businessDayConvention>
            <dateRelativeTo href="p1" />
          </paymentDate>
        </fixedPayment>
      </fixedLeg>
    </dividendSwapTransactionSupplement>
  </trade>
  <party id="kom722">
    <partyId>Party A</partyId>
  </party>
  <party id="kow029">
    <partyId>Party B</partyId>
  </party>
</confirmationAgreed>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var requestConfirmationElm = new Tns.RequestConfirmationElm();
            {
                var trade = new Tns.TradeCt();
                var partyTradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers.PartyReference.Href = "kom722";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.partyA.com/coding-scheme/trade-id";
                        tradeIds.Value = "6234";
                        partyTradeIdentifiers.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers);
                }
                var partyTradeIdentifiers1 = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers1.PartyReference.Href = "kow029";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.partyB.com/coding-scheme/trade-id";
                        tradeIds.Value = "6569";
                        partyTradeIdentifiers1.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers1);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2007, 1, 5, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.CorrelationSwapElm();
                    product.CorrelationLeg.Amount.Correlation.NotionalAmount.Amount = BigDecimal.Parse("350000");
                    product.CorrelationLeg.Amount.Correlation.NotionalAmount.Currency.Value = "USD";
                    product.CorrelationLeg.Amount.Correlation.CorrelationStrikePrice = BigDecimal.Parse("0.60123");
                    {
                        var boundedCorrelation = new Tns.BoundedCorrelationCt();
                        boundedCorrelation.MinimumBoundaryPercent = BigDecimal.Parse("0.35123");
                        boundedCorrelation.MaximumBoundaryPercent = BigDecimal.Parse("0.85123");
                        product.CorrelationLeg.Amount.Correlation.BoundedCorrelation = boundedCorrelation;
                    }
                    product.CorrelationLeg.Amount.Correlation.NumberOfDataSeries = System.Numerics.BigInteger.Parse("1");
                    product.CorrelationLeg.Amount.Correlation.ClosingLevel = true;
                    product.CorrelationLeg.Amount.Correlation.ExpectedN = System.Numerics.BigInteger.Parse("120");
                    {
                        var observationStartDate = new Tns.AdjustableOrRelativeDateCt();
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2007, 1, 5, 0, 0, 0, 0, 0, 0, false);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            observationStartDate.AdjustableDate = adjustableDate;
                        }
                        product.CorrelationLeg.Amount.ObservationStartDate = observationStartDate;
                    }
                    product.CorrelationLeg.Amount.AllDividends = false;
                    {
                        var valuationDate = new Tns.AdjustableDateOrRelativeDateSequenceCt();
                        valuationDate.Id = "vd903";
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2009, 12, 19, 0, 0, 0, 0, 0, 0, false);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NotApplicable;
                            valuationDate.AdjustableDate = adjustableDate;
                        }
                        product.CorrelationLeg.Valuation.ValuationDate = valuationDate;
                    }
                    {
                        var basket = new Tns.BasketCt();
                        var basketConstituents = new Tns.BasketConstituentCt();
                        {
                            {
                                var underlyingAsset = new Tns.EquityElm();
                                {
                                    var currency = new Tns.IdentifiedCurrencyCt();
                                    currency.Value = "USD";
                                    underlyingAsset.Currency = currency;
                                }
                                {
                                    var exchangeId = new Tns.ExchangeIdCt();
                                    exchangeId.Value = "NYSE";
                                    underlyingAsset.ExchangeId = exchangeId;
                                }
                                var instrumentIds = new Tns.InstrumentIdCt();
                                {
                                    instrumentIds.InstrumentIdScheme = "http://www.fpml.org/schemes/4.1/instrumentId";
                                    instrumentIds.Value = "IBM.N";
                                    underlyingAsset.InstrumentIds.Add(instrumentIds);
                                }
                                underlyingAsset.Description = "International Business Machines Common Share";
                                basketConstituents.UnderlyingAsset = underlyingAsset;
                            }
                            basket.BasketConstituents.Add(basketConstituents);
                        }
                        var basketConstituents1 = new Tns.BasketConstituentCt();
                        {
                            {
                                var underlyingAsset = new Tns.EquityElm();
                                {
                                    var currency = new Tns.IdentifiedCurrencyCt();
                                    currency.Value = "USD";
                                    underlyingAsset.Currency = currency;
                                }
                                {
                                    var exchangeId = new Tns.ExchangeIdCt();
                                    exchangeId.Value = "NASDAQ";
                                    underlyingAsset.ExchangeId = exchangeId;
                                }
                                var instrumentIds = new Tns.InstrumentIdCt();
                                {
                                    instrumentIds.InstrumentIdScheme = "http://www.fpml.org/schemes/4.1/instrumentId";
                                    instrumentIds.Value = "MSFT.O";
                                    underlyingAsset.InstrumentIds.Add(instrumentIds);
                                }
                                underlyingAsset.Description = "Microsoft Common Share";
                                basketConstituents1.UnderlyingAsset = underlyingAsset;
                            }
                            basket.BasketConstituents.Add(basketConstituents1);
                        }
                        var basketConstituents2 = new Tns.BasketConstituentCt();
                        {
                            {
                                var underlyingAsset = new Tns.EquityElm();
                                {
                                    var currency = new Tns.IdentifiedCurrencyCt();
                                    currency.Value = "USD";
                                    underlyingAsset.Currency = currency;
                                }
                                {
                                    var exchangeId = new Tns.ExchangeIdCt();
                                    exchangeId.Value = "NYSE";
                                    underlyingAsset.ExchangeId = exchangeId;
                                }
                                var instrumentIds = new Tns.InstrumentIdCt();
                                {
                                    instrumentIds.InstrumentIdScheme = "http://www.fpml.org/schemes/4.1/instrumentId";
                                    instrumentIds.Value = "B.N";
                                    underlyingAsset.InstrumentIds.Add(instrumentIds);
                                }
                                underlyingAsset.Description = "Barnes and Noble Common Share";
                                basketConstituents2.UnderlyingAsset = underlyingAsset;
                            }
                            basket.BasketConstituents.Add(basketConstituents2);
                        }
                        basket.Id = "SP500Top3";
                        product.CorrelationLeg.Underlyer.Basket = basket;
                    }
                    product.CorrelationLeg.SettlementType = new Ns.SettlementTypeEnumUnion(Tns.CashPhysicalEnumEnum.Cash);
                    {
                        var settlementDate = new Tns.AdjustableOrRelativeDateCt();
                        {
                            var relativeDate = new Tns.RelativeDateOffsetCt();
                            relativeDate.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                var businessCenters1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters1.Value = "USNY";
                                    businessCenters.BusinessCenters.Add(businessCenters1);
                                }
                                relativeDate.BusinessCenters = businessCenters;
                            }
                            relativeDate.DateRelativeTo.Href = "vd903";
                            relativeDate.DayType = Tns.DayTypeEnumEnum.CurrencyBusiness;
                            relativeDate.PeriodMultiplier = System.Numerics.BigInteger.Parse("2");
                            relativeDate.Period = Tns.PeriodEnumEnum.D;
                            settlementDate.RelativeDate = relativeDate;
                        }
                        product.CorrelationLeg.SettlementDate = settlementDate;
                    }
                    product.CorrelationLeg.PayerPartyReference.Href = "kom722";
                    product.CorrelationLeg.ReceiverPartyReference.Href = "kow029";
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReferences = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReferences.Href = "kom722";
                        calculationAgent.CalculationAgentPartyReferences.Add(calculationAgentPartyReferences);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA";
                        {
                            var masterAgreementVersion = new Tns.MasterAgreementVersionCt();
                            masterAgreementVersion.Value = "2002";
                            masterAgreement.MasterAgreementVersion = masterAgreementVersion;
                        }
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA2000";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    var contractualDefinitions1 = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions1.Value = "ISDA2002Equity";
                        documentation.ContractualDefinitions.Add(contractualDefinitions1);
                    }
                    trade.Documentation = documentation;
                }
                {
                    var governingLaw = new Tns.GoverningLawCt();
                    governingLaw.Value = "GBEN";
                    trade.GoverningLaw = governingLaw;
                }
                requestConfirmationElm.Trade = trade;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "kom722";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party A";
                    parties.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "kow029";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party B";
                    parties1.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties1);
            }
            requestConfirmationElm.IsCorrection = false;
            requestConfirmationElm.CorrelationId.CorrelationIdScheme = "http://www.example.com/conversationId";
            requestConfirmationElm.CorrelationId.Value = "CORR/2000/08/01/234234923120";
            requestConfirmationElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            requestConfirmationElm.Header.SentBy.MessageAddressScheme = "http://www.partyA.com/coding-scheme/party-id";
            requestConfirmationElm.Header.SentBy.Value = "23902";
            requestConfirmationElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2000, 8, 1, 8, 57, 0, 0, 0, 0, 0, 0);
            requestConfirmationElm.Header.MessageId.MessageIdScheme = "http://www.partyA.com/coding-scheme/message-id";
            requestConfirmationElm.Header.MessageId.Value = "234234923420";
            requestConfirmationElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.RequestConfirmationElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, requestConfirmationElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
        == Copyright (c) 2002-2010. All rights reserved. 
        == Financial Products Markup Language is subject to the FpML public license. 
        == A copy of this license is available at http://www.fpml.org/license/license.html-->
<!--5.0:Message type is a Root of the message-->
<!--5.0 Messaging: changed <requestTradeConfirmation> -><requestConfirmation>-->
<requestConfirmation xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
<!-- AP 10 Oct 2007 Revised draft proposal from Citadel -->
  <header>
    <messageId messageIdScheme="http://www.partyA.com/coding-scheme/message-id">234234923420</messageId>
    <sentBy messageAddressScheme="http://www.partyA.com/coding-scheme/party-id">23902</sentBy>
    <creationTimestamp>2000-08-01T08:57:00-00:00</creationTimestamp>
  </header>
<!--5.0 Messaging: added
                <isCorrection>
                <correlationId>
                <sequenceNumber>
        -->
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.example.com/conversationId">CORR/2000/08/01/234234923120</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="kom722" />
        <tradeId tradeIdScheme="http://www.partyA.com/coding-scheme/trade-id">6234</tradeId>
      </partyTradeIdentifier>
      <partyTradeIdentifier>
        <partyReference href="kow029" />
        <tradeId tradeIdScheme="http://www.partyB.com/coding-scheme/trade-id">6569</tradeId>
      </partyTradeIdentifier>
      <tradeDate>2007-01-05</tradeDate>
    </tradeHeader>
    <correlationSwap>
      <correlationLeg>
        <payerPartyReference href="kom722" />
        <receiverPartyReference href="kow029" />
        <underlyer>
          <basket id="SP500Top3">
            <basketConstituent>
              <equity>
                <instrumentId instrumentIdScheme="http://www.fpml.org/schemes/4.1/instrumentId">IBM.N</instrumentId>
                <description>International Business Machines Common Share</description>
                <currency>USD</currency>
                <exchangeId>NYSE</exchangeId>
              </equity>
            </basketConstituent>
            <basketConstituent>
              <equity>
                <instrumentId instrumentIdScheme="http://www.fpml.org/schemes/4.1/instrumentId">MSFT.O</instrumentId>
                <description>Microsoft Common Share</description>
                <currency>USD</currency>
                <exchangeId>NASDAQ</exchangeId>
              </equity>
            </basketConstituent>
            <basketConstituent>
              <equity>
                <instrumentId instrumentIdScheme="http://www.fpml.org/schemes/4.1/instrumentId">B.N</instrumentId>
                <description>Barnes and Noble Common Share</description>
                <currency>USD</currency>
                <exchangeId>NYSE</exchangeId>
              </equity>
            </basketConstituent>
          </basket>
        </underlyer>
        <settlementType>Cash</settlementType>
        <settlementDate>
          <relativeDate>
            <periodMultiplier>2</periodMultiplier>
            <period>D</period>
            <dayType>CurrencyBusiness</dayType>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCenters>
              <businessCenter>USNY</businessCenter>
            </businessCenters>
            <dateRelativeTo href="vd903" />
          </relativeDate>
        </settlementDate>
        <valuation>
          <valuationDate id="vd903">
            <adjustableDate>
              <unadjustedDate>2009-12-19</unadjustedDate>
              <dateAdjustments>
                <businessDayConvention>NotApplicable</businessDayConvention>
              </dateAdjustments>
            </adjustableDate>
          </valuationDate>
        </valuation>
        <amount>
          <observationStartDate>
            <adjustableDate>
              <unadjustedDate>2007-01-05</unadjustedDate>
              <dateAdjustments>
                <businessDayConvention>NotApplicable</businessDayConvention>
              </dateAdjustments>
            </adjustableDate>
          </observationStartDate>
          <allDividends>false</allDividends>
          <correlation>
            <closingLevel>true</closingLevel>
            <expectedN>120</expectedN>
            <notionalAmount>
              <currency>USD</currency>
              <amount>350000</amount>
            </notionalAmount>
            <correlationStrikePrice>0.60123</correlationStrikePrice>
            <boundedCorrelation>
              <minimumBoundaryPercent>0.35123</minimumBoundaryPercent>
              <maximumBoundaryPercent>0.85123</maximumBoundaryPercent>
            </boundedCorrelation>
            <numberOfDataSeries>1</numberOfDataSeries>
          </correlation>
        </amount>
      </correlationLeg>
    </correlationSwap>
    <calculationAgent>
      <calculationAgentPartyReference href="kom722" />
    </calculationAgent>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA</masterAgreementType>
        <masterAgreementVersion>2002</masterAgreementVersion>
      </masterAgreement>
      <contractualDefinitions>ISDA2000</contractualDefinitions>
      <contractualDefinitions>ISDA2002Equity</contractualDefinitions>
    </documentation>
    <governingLaw>GBEN</governingLaw>
  </trade>
  <party id="kom722">
    <partyId>Party A</partyId>
  </party>
  <party id="kow029">
    <partyId>Party B</partyId>
  </party>
</requestConfirmation>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var requestConsentElm = new Tns.RequestConsentElm();
            {
                var increase = new Tns.TradeNotionalChangeCt();
                increase.ChangeInNumberOfOptions = BigDecimal.Parse("100");
                increase.OutstandingNumberOfOptions = BigDecimal.Parse("300");
                var tradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    tradeIdentifiers.PartyReference.Href = "party1";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.drkw.com/tradeId/OTC";
                        tradeIds.Value = "1234";
                        tradeIdentifiers.TradeIds.Add(tradeIds);
                    }
                    increase.TradeIdentifiers.Add(tradeIdentifiers);
                }
                increase.AgreementDate = new LxDateTime(LxDateTimeType.Date, 2004, 4, 28, 0, 0, 0, 0, 0, 0, true);
                increase.EffectiveDate = new LxDateTime(LxDateTimeType.Date, 2004, 4, 30, 0, 0, 0, 0, 0, 0, true);
                requestConsentElm.Increase = increase;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "party1";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "DRKW";
                    parties.PartyIds.Add(partyIds);
                }
                requestConsentElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "party2";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party B";
                    parties1.PartyIds.Add(partyIds);
                }
                requestConsentElm.Parties.Add(parties1);
            }
            requestConsentElm.IsCorrection = false;
            requestConsentElm.CorrelationId.CorrelationIdScheme = "http://www.drkw.com/conversationId/OTC";
            requestConsentElm.CorrelationId.Value = "OTCCallorPutSpread45678";
            requestConsentElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            requestConsentElm.Header.SentBy.MessageAddressScheme = "http://www.MsgParty.com/partyId";
            requestConsentElm.Header.SentBy.Value = "drkw";
            requestConsentElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2000, 8, 1, 8, 57, 0, 0, 0, 0, true);
            requestConsentElm.Header.MessageId.MessageIdScheme = "http://www.drkw.com/messageId/OTC";
            requestConsentElm.Header.MessageId.Value = "OTCCallorPutSpread456a789b";
            requestConsentElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.RequestConsentElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, requestConsentElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
  == Copyright (c) 2002-2010. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/license/license.html
-->
<requestConsent xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
    <messageId messageIdScheme="http://www.drkw.com/messageId/OTC">OTCCallorPutSpread456a789b</messageId>
    <sentBy messageAddressScheme="http://www.MsgParty.com/partyId">drkw</sentBy>
    <creationTimestamp>2000-08-01T08:57:00Z</creationTimestamp>
  </header>
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.drkw.com/conversationId/OTC">OTCCallorPutSpread45678</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <increase>
    <tradeIdentifier>
      <partyReference href="party1" />
      <tradeId tradeIdScheme="http://www.drkw.com/tradeId/OTC">1234</tradeId>
    </tradeIdentifier>
    <agreementDate>2004-04-28Z</agreementDate>
    <effectiveDate>2004-04-30Z</effectiveDate>
    <changeInNumberOfOptions>100.00</changeInNumberOfOptions>
    <outstandingNumberOfOptions>300.00</outstandingNumberOfOptions>
  </increase>
  <party id="party1">
    <partyId>DRKW</partyId>
  </party>
  <party id="party2">
    <partyId>Party B</partyId>
  </party>
</requestConsent>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var requestConfirmationElm = new Tns.RequestConfirmationElm();
            {
                var trade = new Tns.TradeCt();
                var partyTradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers.PartyReference.Href = "party1";
                    var tradeIds = new Tns.TradeIdCt();
                    {
                        tradeIds.TradeIdScheme = "http://www.drkw.com/tradeId/OTC";
                        tradeIds.Value = "1234";
                        partyTradeIdentifiers.TradeIds.Add(tradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers);
                }
                trade.TradeHeader.TradeDate.Id = "TradeDate";
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2001, 7, 13, 0, 0, 0, 0, 0, 0, true);
                {
                    var product = new Tns.EquityOptionTransactionSupplementElm();
                    product.Strike.StrikePrice = BigDecimal.Parse("32");
                    product.SpotPrice = BigDecimal.Parse("30");
                    product.NumberOfOptions = BigDecimal.Parse("10000");
                    product.EquityPremium.PayerPartyReference.Href = "party2";
                    product.EquityPremium.ReceiverPartyReference.Href = "party1";
                    {
                        var paymentAmount = new Tns.NonNegativeMoneyCt();
                        paymentAmount.Amount = BigDecimal.Parse("405000");
                        paymentAmount.Currency.Value = "EUR";
                        product.EquityPremium.PaymentAmount = paymentAmount;
                    }
                    {
                        var paymentDate = new Tns.AdjustableDateCt();
                        paymentDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2001, 7, 17, 0, 0, 0, 0, 0, 0, true);
                        paymentDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                        product.EquityPremium.PaymentDate = paymentDate;
                    }
                    {
                        var pricePerOption = new Tns.NonNegativeMoneyCt();
                        pricePerOption.Amount = BigDecimal.Parse("2.7");
                        pricePerOption.Currency.Value = "EUR";
                        product.EquityPremium.PricePerOption = pricePerOption;
                    }
                    product.BuyerPartyReference.Href = "party2";
                    product.SellerPartyReference.Href = "party1";
                    product.OptionType = new Ns.EquityOptionTypeEnumUnion(Tns.PutCallEnumEnum.Put);
                    {
                        var singleUnderlyer = new Tns.SingleUnderlyerCt();
                        {
                            var underlyingAsset = new Tns.EquityElm();
                            {
                                var exchangeId = new Tns.ExchangeIdCt();
                                exchangeId.ExchangeIdScheme = "http://www.fpml.org/schemes/4.1/exchangeId";
                                exchangeId.Value = "NSE";
                                underlyingAsset.ExchangeId = exchangeId;
                            }
                            var instrumentIds = new Tns.InstrumentIdCt();
                            {
                                instrumentIds.InstrumentIdScheme = "http://www.fpml.org/schemes/4.1/instrumentId";
                                instrumentIds.Value = "STM-FP";
                                underlyingAsset.InstrumentIds.Add(instrumentIds);
                            }
                            underlyingAsset.Description = "STMicroelectronics N.V. ordinary shares";
                            singleUnderlyer.UnderlyingAsset = underlyingAsset;
                        }
                        product.Underlyer.SingleUnderlyer = singleUnderlyer;
                    }
                    {
                        var equityAmericanExercise = new Tns.EquityAmericanExerciseCt();
                        equityAmericanExercise.LatestExerciseTimeType = Tns.TimeTypeEnumEnum.SpecificTime;
                        equityAmericanExercise.EquityExpirationTimeType = Tns.TimeTypeEnumEnum.Close;
                        {
                            var adjustableDate = new Tns.AdjustableDateCt();
                            adjustableDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2001, 7, 13, 0, 0, 0, 0, 0, 0, true);
                            adjustableDate.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                            equityAmericanExercise.CommencementDate.AdjustableDate = adjustableDate;
                        }
                        {
                            var adjustableDate1 = new Tns.AdjustableDateCt();
                            adjustableDate1.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2001, 9, 27, 0, 0, 0, 0, 0, 0, true);
                            adjustableDate1.DateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.NONE;
                            equityAmericanExercise.ExpirationDate.AdjustableDate = adjustableDate1;
                        }
                        {
                            var latestExerciseTime = new Tns.BusinessCenterTimeCt();
                            latestExerciseTime.HourMinuteTime = new LxDateTime(LxDateTimeType.Time, 0, 0, 0, 17, 15, 0, 0, 0, 0, false);
                            latestExerciseTime.BusinessCenter.Value = "GBLO";
                            equityAmericanExercise.LatestExerciseTime = latestExerciseTime;
                        }
                        product.EquityExercise.EquityAmericanExercise = equityAmericanExercise;
                    }
                    product.EquityExercise.AutomaticExercise = true;
                    product.EquityExercise.EquityValuation.ValuationTimeType = Tns.TimeTypeEnumEnum.Close;
                    product.EquityExercise.SettlementCurrency.Value = "EUR";
                    {
                        var settlementPriceSource = new Tns.SettlementPriceSourceCt();
                        settlementPriceSource.Value = "OfficialClose";
                        product.EquityExercise.SettlementPriceSource = settlementPriceSource;
                    }
                    product.EquityExercise.SettlementType = new Ns.SettlementTypeEnumUnion(Tns.CashPhysicalEnumEnum.Cash);
                    var productTypes = new Tns.ProductTypeCt();
                    {
                        productTypes.Value = "americanCallStock";
                        product.ProductTypes.Add(productTypes);
                    }
                    trade.Product = product;
                }
                {
                    var calculationAgent = new Tns.CalculationAgentCt();
                    var calculationAgentPartyReferences = new Tns.PartyReferenceCt();
                    {
                        calculationAgentPartyReferences.Href = "party1";
                        calculationAgent.CalculationAgentPartyReferences.Add(calculationAgentPartyReferences);
                    }
                    trade.CalculationAgent = calculationAgent;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterAgreement = new Tns.MasterAgreementCt();
                        masterAgreement.MasterAgreementType.Value = "ISDA2002";
                        documentation.MasterAgreement = masterAgreement;
                    }
                    var contractualDefinitions = new Tns.ContractualDefinitionsCt();
                    {
                        contractualDefinitions.Value = "ISDA2002Equity";
                        documentation.ContractualDefinitions.Add(contractualDefinitions);
                    }
                    trade.Documentation = documentation;
                }
                {
                    var governingLaw = new Tns.GoverningLawCt();
                    governingLaw.Value = "GBEN";
                    trade.GoverningLaw = governingLaw;
                }
                requestConfirmationElm.Trade = trade;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "party1";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party A";
                    parties.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "party2";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "Party B";
                    parties1.PartyIds.Add(partyIds);
                }
                requestConfirmationElm.Parties.Add(parties1);
            }
            requestConfirmationElm.IsCorrection = false;
            requestConfirmationElm.CorrelationId.CorrelationIdScheme = "http://www.drkw.com/conversationId/OTC";
            requestConfirmationElm.CorrelationId.Value = "OTCCallorPutSpread45678";
            requestConfirmationElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            requestConfirmationElm.Header.SentBy.MessageAddressScheme = "http://www.MsgParty.com/partyId";
            requestConfirmationElm.Header.SentBy.Value = "drkw";
            requestConfirmationElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2000, 8, 1, 8, 57, 0, 0, 0, 0, true);
            requestConfirmationElm.Header.MessageId.MessageIdScheme = "http://www.drkw.com/messageId/OTC";
            requestConfirmationElm.Header.MessageId.Value = "OTCCallorPutSpread456a789b";
            requestConfirmationElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.RequestConfirmationElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, requestConfirmationElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
  == Copyright (c) 2002-2010. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/license/license.html
-->
<requestConfirmation xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
    <messageId messageIdScheme="http://www.drkw.com/messageId/OTC">OTCCallorPutSpread456a789b</messageId>
    <sentBy messageAddressScheme="http://www.MsgParty.com/partyId">drkw</sentBy>
    <creationTimestamp>2000-08-01T08:57:00Z</creationTimestamp>
  </header>
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.drkw.com/conversationId/OTC">OTCCallorPutSpread45678</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <trade>
    <tradeHeader>
      <partyTradeIdentifier>
        <partyReference href="party1" />
        <tradeId tradeIdScheme="http://www.drkw.com/tradeId/OTC">1234</tradeId>
      </partyTradeIdentifier>
      <tradeDate id="TradeDate">2001-07-13Z</tradeDate>
    </tradeHeader>
    <equityOptionTransactionSupplement>
      <productType>americanCallStock</productType>
      <buyerPartyReference href="party2" />
      <sellerPartyReference href="party1" />
      <optionType>Put</optionType>
      <underlyer>
        <singleUnderlyer>
          <equity>
            <instrumentId instrumentIdScheme="http://www.fpml.org/schemes/4.1/instrumentId">STM-FP</instrumentId>
            <description>STMicroelectronics N.V. ordinary shares</description>
            <exchangeId exchangeIdScheme="http://www.fpml.org/schemes/4.1/exchangeId">NSE</exchangeId>
          </equity>
        </singleUnderlyer>
      </underlyer>
      <equityExercise>
        <equityAmericanExercise>
          <commencementDate>
            <adjustableDate>
              <unadjustedDate>2001-07-13Z</unadjustedDate>
              <dateAdjustments>
                <businessDayConvention>NONE</businessDayConvention>
              </dateAdjustments>
            </adjustableDate>
          </commencementDate>
          <expirationDate>
            <adjustableDate>
              <unadjustedDate>2001-09-27Z</unadjustedDate>
              <dateAdjustments>
                <businessDayConvention>NONE</businessDayConvention>
              </dateAdjustments>
            </adjustableDate>
          </expirationDate>
          <latestExerciseTime>
            <hourMinuteTime>17:15:00</hourMinuteTime>
            <businessCenter>GBLO</businessCenter>
          </latestExerciseTime>
          <latestExerciseTimeType>SpecificTime</latestExerciseTimeType>
          <equityExpirationTimeType>Close</equityExpirationTimeType>
        </equityAmericanExercise>
        <automaticExercise>true</automaticExercise>
        <equityValuation>
          <valuationTimeType>Close</valuationTimeType>
        </equityValuation>
        <settlementCurrency>EUR</settlementCurrency>
        <settlementPriceSource>OfficialClose</settlementPriceSource>
        <settlementType>Cash</settlementType>
      </equityExercise>
      <strike>
        <strikePrice>32.00</strikePrice>
      </strike>
      <spotPrice>30.00</spotPrice>
      <numberOfOptions>10000</numberOfOptions>
      <equityPremium>
        <payerPartyReference href="party2" />
        <receiverPartyReference href="party1" />
        <paymentAmount>
          <currency>EUR</currency>
          <amount>405000</amount>
        </paymentAmount>
        <paymentDate>
          <unadjustedDate>2001-07-17Z</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>NONE</businessDayConvention>
          </dateAdjustments>
        </paymentDate>
        <pricePerOption>
          <currency>EUR</currency>
          <amount>2.70</amount>
        </pricePerOption>
      </equityPremium>
    </equityOptionTransactionSupplement>
    <calculationAgent>
      <calculationAgentPartyReference href="party1" />
    </calculationAgent>
    <documentation>
      <masterAgreement>
        <masterAgreementType>ISDA2002</masterAgreementType>
      </masterAgreement>
      <contractualDefinitions>ISDA2002Equity</contractualDefinitions>
    </documentation>
    <governingLaw>GBEN</governingLaw>
  </trade>
  <party id="party1">
    <partyId>Party A</partyId>
  </party>
  <party id="party2">
    <partyId>Party B</partyId>
  </party>
</requestConfirmation>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var requestAllocationElm = new Tns.RequestAllocationElm();
            requestAllocationElm.BlockTradeIdentifier.PartyReference.Href = "party2";
            var tradeIds = new Tns.TradeIdCt();
            {
                tradeIds.TradeIdScheme = "http://www.swapswire.com/spec/2001/trade-id-1-0";
                tradeIds.Value = "10000";
                requestAllocationElm.BlockTradeIdentifier.TradeIds.Add(tradeIds);
            }
            var allocations = new Tns.AllocationCt();
            {
                allocations.AllocationTradeId.PartyReference.Href = "party2";
                var tradeIds1 = new Tns.TradeIdCt();
                {
                    tradeIds1.TradeIdScheme = "http://www.swapswire.com/spec/2001/trade-id-1-0";
                    tradeIds1.Value = "30001";
                    allocations.AllocationTradeId.TradeIds.Add(tradeIds1);
                }
                allocations.PartyReference.Href = "party3";
                {
                    var accountReference = new Tns.AccountReferenceCt();
                    accountReference.Href = "ACC2";
                    allocations.AccountReference = accountReference;
                }
                allocations.AllocatedFraction = BigDecimal.Parse("0.4");
                {
                    var collateral = new Tns.CollateralCt();
                    collateral.IndependentAmount.PayerPartyReference.Href = "party3";
                    collateral.IndependentAmount.ReceiverPartyReference.Href = "party2";
                    var paymentDetails = new Tns.PaymentDetailCt();
                    {
                        var paymentAmounts = new Tns.MoneyCt();
                        {
                            paymentAmounts.Amount = BigDecimal.Parse("2400000");
                            paymentAmounts.Currency.Value = "USD";
                            paymentDetails.PaymentAmounts.Add(paymentAmounts);
                        }
                        collateral.IndependentAmount.PaymentDetails.Add(paymentDetails);
                    }
                    allocations.Collateral = collateral;
                }
                {
                    var creditChargeAmount = new Tns.MoneyCt();
                    creditChargeAmount.Amount = BigDecimal.Parse("20000");
                    creditChargeAmount.Currency.Value = "USD";
                    allocations.CreditChargeAmount = creditChargeAmount;
                }
                {
                    var approvals = new Tns.ApprovalsCt();
                    var approvals1 = new Tns.ApprovalCt();
                    {
                        approvals1.Type = "Treasury";
                        approvals1.Status = "Pre-Approved";
                        approvals.Approvals.Add(approvals1);
                    }
                    var approvals2 = new Tns.ApprovalCt();
                    {
                        approvals2.Type = "Credit";
                        approvals2.Status = "Manual Review";
                        approvals2.Approver = "Robert Smith";
                        approvals.Approvals.Add(approvals2);
                    }
                    allocations.Approvals = approvals;
                }
                requestAllocationElm.Allocations.Allocations.Add(allocations);
            }
            var allocations1 = new Tns.AllocationCt();
            {
                allocations1.AllocationTradeId.PartyReference.Href = "party2";
                var tradeIds1 = new Tns.TradeIdCt();
                {
                    tradeIds1.TradeIdScheme = "http://www.swapswire.com/spec/2001/trade-id-1-0";
                    tradeIds1.Value = "30002";
                    allocations1.AllocationTradeId.TradeIds.Add(tradeIds1);
                }
                allocations1.PartyReference.Href = "party3";
                {
                    var accountReference = new Tns.AccountReferenceCt();
                    accountReference.Href = "ACC3";
                    allocations1.AccountReference = accountReference;
                }
                allocations1.AllocatedFraction = BigDecimal.Parse("0.6");
                {
                    var collateral = new Tns.CollateralCt();
                    collateral.IndependentAmount.PayerPartyReference.Href = "party3";
                    collateral.IndependentAmount.ReceiverPartyReference.Href = "party2";
                    var paymentDetails = new Tns.PaymentDetailCt();
                    {
                        var paymentAmounts = new Tns.MoneyCt();
                        {
                            paymentAmounts.Amount = BigDecimal.Parse("1200000");
                            paymentAmounts.Currency.Value = "USD";
                            paymentDetails.PaymentAmounts.Add(paymentAmounts);
                        }
                        collateral.IndependentAmount.PaymentDetails.Add(paymentDetails);
                    }
                    allocations1.Collateral = collateral;
                }
                {
                    var approvals = new Tns.ApprovalsCt();
                    var approvals1 = new Tns.ApprovalCt();
                    {
                        approvals1.Type = "Treasury";
                        approvals1.Status = "Pre-Approved";
                        approvals.Approvals.Add(approvals1);
                    }
                    var approvals2 = new Tns.ApprovalCt();
                    {
                        approvals2.Type = "Credit";
                        approvals2.Status = "Pre-Approved";
                        approvals.Approvals.Add(approvals2);
                    }
                    allocations1.Approvals = approvals;
                }
                requestAllocationElm.Allocations.Allocations.Add(allocations1);
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "party1";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.PartyIdScheme = "http://www.fpml.org/ext/iso9362";
                    partyIds.Value = "BGIUS42";
                    parties.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "Barclays Global Investors";
                    parties.PartyName = partyName;
                }
                requestAllocationElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "party2";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.PartyIdScheme = "http://www.fpml.org/ext/iso9362";
                    partyIds.Value = "PARTY2US33";
                    parties1.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "Party 2 Global Risk Management";
                    parties1.PartyName = partyName;
                }
                requestAllocationElm.Parties.Add(parties1);
            }
            var parties2 = new Tns.PartyCt();
            {
                parties2.Id = "party3";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.PartyIdScheme = "http://www.fpml.org/ext/iso9362";
                    partyIds.Value = "CALPERS";
                    parties2.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "California Public Employees' Retirement System";
                    parties2.PartyName = partyName;
                }
                requestAllocationElm.Parties.Add(parties2);
            }
            var accounts = new Tns.AccountCt();
            {
                accounts.Id = "ACC1";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.Value = "bgcf22j";
                    accounts.AccountIds.Add(accountIds);
                }
                var accountNames = new Tns.AccountNameCt();
                {
                    accountNames.Value = "Barclays Global Investors 2";
                    accounts.AccountNames.Add(accountNames);
                }
                var servicingParties = new Tns.PartyReferenceCt();
                {
                    servicingParties.Href = "party1";
                    accounts.ServicingParties.Add(servicingParties);
                }
                requestAllocationElm.Accounts.Add(accounts);
            }
            var accounts1 = new Tns.AccountCt();
            {
                accounts1.Id = "ACC0";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.AccountIdScheme = "http://www.party2.com/bondifre";
                    accountIds.Value = "5462346";
                    accounts1.AccountIds.Add(accountIds);
                }
                var accountNames = new Tns.AccountNameCt();
                {
                    accountNames.Value = "LDF Main Fund";
                    accounts1.AccountNames.Add(accountNames);
                }
                var servicingParties = new Tns.PartyReferenceCt();
                {
                    servicingParties.Href = "party2";
                    accounts1.ServicingParties.Add(servicingParties);
                }
                requestAllocationElm.Accounts.Add(accounts1);
            }
            var accounts2 = new Tns.AccountCt();
            {
                accounts2.Id = "ACC2";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.Value = "cvgh44h";
                    accounts2.AccountIds.Add(accountIds);
                }
                var accountNames = new Tns.AccountNameCt();
                {
                    accountNames.Value = "CALPERS A/C 1";
                    accounts2.AccountNames.Add(accountNames);
                }
                var servicingParties = new Tns.PartyReferenceCt();
                {
                    servicingParties.Href = "party3";
                    accounts2.ServicingParties.Add(servicingParties);
                }
                requestAllocationElm.Accounts.Add(accounts2);
            }
            var accounts3 = new Tns.AccountCt();
            {
                accounts3.Id = "ACC3";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.Value = "cvgh45h";
                    accounts3.AccountIds.Add(accountIds);
                }
                var accountNames = new Tns.AccountNameCt();
                {
                    accountNames.Value = "CALPERS Account 23";
                    accounts3.AccountNames.Add(accountNames);
                }
                var servicingParties = new Tns.PartyReferenceCt();
                {
                    servicingParties.Href = "party3";
                    accounts3.ServicingParties.Add(servicingParties);
                }
                requestAllocationElm.Accounts.Add(accounts3);
            }
            requestAllocationElm.IsCorrection = false;
            requestAllocationElm.CorrelationId.CorrelationIdScheme = "http://www.party2.com/correlation-id";
            requestAllocationElm.CorrelationId.Value = "18671867";
            requestAllocationElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            requestAllocationElm.Header.SentBy.Value = "PARTY2US33";
            requestAllocationElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2002, 12, 3, 9, 57, 0, 0, 0, 0, true);
            requestAllocationElm.Header.MessageId.MessageIdScheme = "http://www.party2.com/message-id";
            requestAllocationElm.Header.MessageId.Value = "123453212";
            requestAllocationElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.RequestAllocationElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, requestAllocationElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
  == Copyright (c) 2009. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/license/license.html
  -->
<!--
  == This example describes an allocated client trade in its "short form" representation, i.e. not fully expanded for confirmation purposes - rather, stating the economics once and giving a proposed breakdown.  Please note the short form representation is implicit for Fees in the block .
  -->
<requestAllocation xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
    <messageId messageIdScheme="http://www.party2.com/message-id">123453212</messageId>
    <sentBy>PARTY2US33</sentBy>
    <creationTimestamp>2002-12-03T09:57:00Z</creationTimestamp>
  </header>
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.party2.com/correlation-id">18671867</correlationId>
  <sequenceNumber>1</sequenceNumber>
  <blockTradeIdentifier>
    <partyReference href="party2" />
    <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">10000</tradeId>
  </blockTradeIdentifier>
  <allocations>
    <allocation>
      <allocationTradeId>
        <partyReference href="party2" />
        <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">30001</tradeId>
      </allocationTradeId>
      <partyReference href="party3" />
      <accountReference href="ACC2" />
      <allocatedFraction>0.40</allocatedFraction>
      <collateral>
        <independentAmount>
          <payerPartyReference href="party3" />
          <receiverPartyReference href="party2" />
          <paymentDetail>
            <paymentAmount>
              <currency>USD</currency>
              <amount>2400000</amount>
            </paymentAmount>
          </paymentDetail>
        </independentAmount>
      </collateral>
      <creditChargeAmount>
        <currency>USD</currency>
        <amount>20000</amount>
      </creditChargeAmount>
      <approvals>
        <approval>
          <type>Treasury</type>
          <status>Pre-Approved</status>
        </approval>
        <approval>
          <type>Credit</type>
          <status>Manual Review</status>
          <approver>Robert Smith</approver>
        </approval>
      </approvals>
    </allocation>
    <allocation>
      <allocationTradeId>
        <partyReference href="party2" />
        <tradeId tradeIdScheme="http://www.swapswire.com/spec/2001/trade-id-1-0">30002</tradeId>
      </allocationTradeId>
      <partyReference href="party3" />
      <accountReference href="ACC3" />
      <allocatedFraction>0.60</allocatedFraction>
      <collateral>
        <independentAmount>
          <payerPartyReference href="party3" />
          <receiverPartyReference href="party2" />
          <paymentDetail>
            <paymentAmount>
              <currency>USD</currency>
              <amount>1200000</amount>
            </paymentAmount>
          </paymentDetail>
        </independentAmount>
      </collateral>
      <approvals>
        <approval>
          <type>Treasury</type>
          <status>Pre-Approved</status>
        </approval>
        <approval>
          <type>Credit</type>
          <status>Pre-Approved</status>
        </approval>
      </approvals>
    </allocation>
  </allocations>
  <party id="party1">
    <partyId partyIdScheme="http://www.fpml.org/ext/iso9362">BGIUS42</partyId>
    <partyName>Barclays Global Investors</partyName>
  </party>
  <party id="party2">
    <partyId partyIdScheme="http://www.fpml.org/ext/iso9362">PARTY2US33</partyId>
    <partyName>Party 2 Global Risk Management</partyName>
  </party>
  <party id="party3">
    <partyId partyIdScheme="http://www.fpml.org/ext/iso9362">CALPERS</partyId>
    <partyName>California Public Employees' Retirement System</partyName>
  </party>
  <account id="ACC1">
    <accountId>bgcf22j</accountId>
    <accountName>Barclays Global Investors 2</accountName>
    <servicingParty href="party1" />
  </account>
  <account id="ACC0">
    <accountId accountIdScheme="http://www.party2.com/bondifre">5462346</accountId>
    <accountName>LDF Main Fund</accountName>
    <servicingParty href="party2" />
  </account>
  <account id="ACC2">
    <accountId>cvgh44h</accountId>
    <accountName>CALPERS A/C 1</accountName>
    <servicingParty href="party3" />
  </account>
  <account id="ACC3">
    <accountId>cvgh45h</accountId>
    <accountName>CALPERS Account 23</accountName>
    <servicingParty href="party3" />
  </account>
</requestAllocation>

The following code shows how to create an XML document using the FpML nuget.

First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.

using System;
using System.Numerics;
using System.IO;
using System.Text;
using LiquidTechnologies.XmlObjects;
using LiquidTechnologies.XmlObjects.FpML50;
using System.Xml.Linq;
using LiquidTechnologies.XmlObjects;

namespace LiquidTechnologies.Samples
{
    public class XmlGeneratorSample
    {
        public static string CreateXml()
        {
            #region Writing
            var executionAdviceElm = new Tns.ExecutionAdviceElm();
            {
                var trade = new Tns.TradeCt();
                var partyTradeIdentifiers = new Tns.PartyTradeIdentifierCt();
                {
                    partyTradeIdentifiers.PartyReference.Href = "_fund";
                    var versionedTradeIds = new Tns.VersionedTradeIdCt();
                    {
                        versionedTradeIds.TradeId.TradeIdScheme = "http://www.swift.com/coding-scheme/contract-id";
                        versionedTradeIds.TradeId.Value = "CONTR2345";
                        versionedTradeIds.Version = System.Numerics.BigInteger.Parse("1");
                        partyTradeIdentifiers.VersionedTradeIds.Add(versionedTradeIds);
                    }
                    trade.TradeHeader.PartyTradeIdentifiers.Add(partyTradeIdentifiers);
                }
                trade.TradeHeader.TradeDate.Value = new LxDateTime(LxDateTimeType.Date, 2009, 6, 8, 0, 0, 0, 0, 0, 0, false);
                {
                    var product = new Tns.CreditDefaultSwapElm();
                    {
                        var effectiveDate = new Tns.AdjustableDate2Ct();
                        effectiveDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2009, 6, 9, 0, 0, 0, 0, 0, 0, false);
                        {
                            var dateAdjustments = new Tns.BusinessDayAdjustmentsCt();
                            dateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCentersReference = new Tns.BusinessCentersReferenceCt();
                                businessCentersReference.Href = "BCNYLO";
                                dateAdjustments.BusinessCentersReference = businessCentersReference;
                            }
                            effectiveDate.DateAdjustments = dateAdjustments;
                        }
                        product.GeneralTerms.EffectiveDate = effectiveDate;
                    }
                    {
                        var scheduledTerminationDate = new Tns.AdjustableDate2Ct();
                        scheduledTerminationDate.UnadjustedDate.Value = new LxDateTime(LxDateTimeType.Date, 2012, 6, 20, 0, 0, 0, 0, 0, 0, false);
                        {
                            var dateAdjustments = new Tns.BusinessDayAdjustmentsCt();
                            dateAdjustments.BusinessDayConvention = Tns.BusinessDayConventionEnumEnum.FOLLOWING;
                            {
                                var businessCenters = new Tns.BusinessCentersCt();
                                businessCenters.Id = "BCNYLO";
                                var businessCenters1 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters1.Value = "USNY";
                                    businessCenters.BusinessCenters.Add(businessCenters1);
                                }
                                var businessCenters2 = new Tns.BusinessCenterCt();
                                {
                                    businessCenters2.Value = "GBLO";
                                    businessCenters.BusinessCenters.Add(businessCenters2);
                                }
                                dateAdjustments.BusinessCenters = businessCenters;
                            }
                            scheduledTerminationDate.DateAdjustments = dateAdjustments;
                        }
                        product.GeneralTerms.ScheduledTerminationDate = scheduledTerminationDate;
                    }
                    product.GeneralTerms.BuyerPartyReference.Href = "_broker";
                    product.GeneralTerms.SellerPartyReference.Href = "_fund";
                    {
                        var referenceInformation = new Tns.ReferenceInformationCt();
                        {
                            var entityName = new Tns.EntityNameCt();
                            entityName.Value = "0E69A8";
                            referenceInformation.ReferenceEntity.EntityName = entityName;
                        }
                        var entityIds = new Tns.EntityIdCt();
                        {
                            entityIds.EntityIdScheme = "http://www.fpml.com/spec/2003/entity-id-RED-1-0";
                            entityIds.Value = "0E69A8";
                            referenceInformation.ReferenceEntity.EntityIds.Add(entityIds);
                        }
                        var referenceObligations = new Tns.ReferenceObligationCt();
                        {
                            {
                                var bond = new Tns.BondCt();
                                var instrumentIds = new Tns.InstrumentIdCt();
                                {
                                    instrumentIds.InstrumentIdScheme = "http://www.fpml.org/spec/2002/instrument-id-ISIN-1-0";
                                    instrumentIds.Value = "US042735AL41";
                                    bond.InstrumentIds.Add(instrumentIds);
                                }
                                referenceObligations.Bond = bond;
                            }
                            {
                                var primaryObligor = new Tns.LegalEntityCt();
                                {
                                    var entityName1 = new Tns.EntityNameCt();
                                    entityName1.Value = "ARW";
                                    primaryObligor.EntityName = entityName1;
                                }
                                var entityIds1 = new Tns.EntityIdCt();
                                {
                                    entityIds1.EntityIdScheme = "http://www.imgr.com/schemes/entity-id";
                                    entityIds1.Value = "ARW";
                                    primaryObligor.EntityIds.Add(entityIds1);
                                }
                                referenceObligations.PrimaryObligor = primaryObligor;
                            }
                            referenceInformation.ReferenceObligations.Add(referenceObligations);
                        }
                        referenceInformation.AllGuarantees = true;
                        referenceInformation.ReferencePrice = BigDecimal.Parse("87.4");
                        product.GeneralTerms.ReferenceInformation = referenceInformation;
                    }
                    {
                        var initialPayment = new Tns.InitialPaymentCt();
                        initialPayment.PayerPartyReference.Href = "_fund";
                        initialPayment.ReceiverPartyReference.Href = "_broker";
                        initialPayment.PaymentAmount.Amount = BigDecimal.Parse("387300");
                        initialPayment.PaymentAmount.Currency.Value = "USD";
                        product.FeeLeg.InitialPayment = initialPayment;
                    }
                    {
                        var periodicPayment = new Tns.PeriodicPaymentCt();
                        {
                            var paymentFrequency = new Tns.PeriodCt();
                            paymentFrequency.PeriodMultiplier = System.Numerics.BigInteger.Parse("3");
                            paymentFrequency.Period = Tns.PeriodEnumEnum.M;
                            periodicPayment.PaymentFrequency = paymentFrequency;
                        }
                        periodicPayment.FirstPeriodStartDate = new LxDateTime(LxDateTimeType.Date, 2009, 3, 20, 0, 0, 0, 0, 0, 0, false);
                        periodicPayment.FirstPaymentDate = new LxDateTime(LxDateTimeType.Date, 2009, 6, 20, 0, 0, 0, 0, 0, 0, false);
                        periodicPayment.RollConvention = Tns.RollConventionEnumEnum.N20;
                        {
                            var fixedAmountCalculation = new Tns.FixedAmountCalculationCt();
                            {
                                var calculationAmount = new Tns.CalculationAmountCt();
                                calculationAmount.Amount = BigDecimal.Parse("70000000");
                                calculationAmount.Currency.Value = "USD";
                                fixedAmountCalculation.CalculationAmount = calculationAmount;
                            }
                            fixedAmountCalculation.FixedRate.Value = BigDecimal.Parse("0.023");
                            {
                                var dayCountFraction = new Tns.DayCountFractionCt();
                                dayCountFraction.Value = "ACT/360";
                                fixedAmountCalculation.DayCountFraction = dayCountFraction;
                            }
                            periodicPayment.FixedAmountCalculation = fixedAmountCalculation;
                        }
                        product.FeeLeg.PeriodicPayment = periodicPayment;
                    }
                    var protectionTerms = new Tns.ProtectionTermsCt();
                    {
                        protectionTerms.CalculationAmount.Amount = BigDecimal.Parse("70000000");
                        protectionTerms.CalculationAmount.Id = "calculationAmount";
                        protectionTerms.CalculationAmount.Currency.Value = "USD";
                        {
                            var creditEvents = new Tns.CreditEventsCt();
                            creditEvents.Bankruptcy = true;
                            {
                                var failureToPay = new Tns.FailureToPayCt();
                                failureToPay.Applicable = true;
                                {
                                    var paymentRequirement = new Tns.MoneyCt();
                                    paymentRequirement.Amount = BigDecimal.Parse("1000000");
                                    paymentRequirement.Currency.Value = "USD";
                                    failureToPay.PaymentRequirement = paymentRequirement;
                                }
                                creditEvents.FailureToPay = failureToPay;
                            }
                            creditEvents.ObligationAcceleration = true;
                            creditEvents.RepudiationMoratorium = true;
                            {
                                var restructuring = new Tns.RestructuringCt();
                                restructuring.Applicable = true;
                                {
                                    var restructuringType = new Tns.RestructuringTypeCt();
                                    restructuringType.Value = "ModR";
                                    restructuring.RestructuringType = restructuringType;
                                }
                                creditEvents.Restructuring = restructuring;
                            }
                            {
                                var creditEventNotice = new Tns.CreditEventNoticeCt();
                                creditEventNotice.NotifyingParty.BuyerPartyReference.Href = "_broker";
                                {
                                    var publiclyAvailableInformation = new Tns.PubliclyAvailableInformationCt();
                                    publiclyAvailableInformation.StandardPublicSources = true;
                                    publiclyAvailableInformation.SpecifiedNumber = System.Numerics.BigInteger.Parse("2");
                                    creditEventNotice.PubliclyAvailableInformation = publiclyAvailableInformation;
                                }
                                creditEvents.CreditEventNotice = creditEventNotice;
                            }
                            protectionTerms.CreditEvents = creditEvents;
                        }
                        {
                            var obligations = new Tns.ObligationsCt();
                            obligations.Category = Tns.ObligationCategoryEnumEnum.Bond;
                            obligations.NotSubordinated = true;
                            {
                                var notDomesticCurrency = new Tns.NotDomesticCurrencyCt();
                                notDomesticCurrency.Applicable = true;
                                obligations.NotDomesticCurrency = notDomesticCurrency;
                            }
                            obligations.NotDomesticLaw = true;
                            obligations.NotDomesticIssuance = true;
                            protectionTerms.Obligations = obligations;
                        }
                        product.ProtectionTerms.Add(protectionTerms);
                    }
                    var physicalSettlementTerms = new Tns.PhysicalSettlementTermsCt();
                    {
                        {
                            var physicalSettlementPeriod = new Tns.PhysicalSettlementPeriodCt();
                            physicalSettlementPeriod.BusinessDaysNotSpecified = true;
                            physicalSettlementTerms.PhysicalSettlementPeriod = physicalSettlementPeriod;
                        }
                        {
                            var deliverableObligations = new Tns.DeliverableObligationsCt();
                            deliverableObligations.AccruedInterest = false;
                            deliverableObligations.Category = Tns.ObligationCategoryEnumEnum.Bond;
                            deliverableObligations.NotSubordinated = true;
                            {
                                var specifiedCurrency = new Tns.SpecifiedCurrencyCt();
                                specifiedCurrency.Applicable = true;
                                deliverableObligations.SpecifiedCurrency = specifiedCurrency;
                            }
                            deliverableObligations.NotDomesticLaw = true;
                            deliverableObligations.NotContingent = true;
                            deliverableObligations.NotDomesticIssuance = true;
                            deliverableObligations.Transferable = true;
                            deliverableObligations.NotBearer = true;
                            physicalSettlementTerms.DeliverableObligations = deliverableObligations;
                        }
                        physicalSettlementTerms.Escrow = true;
                        {
                            var settlementCurrency = new Tns.CurrencyCt();
                            settlementCurrency.Value = "USD";
                            physicalSettlementTerms.SettlementCurrency = settlementCurrency;
                        }
                        product.PhysicalSettlementTerms.Add(physicalSettlementTerms);
                    }
                    var productTypes = new Tns.ProductTypeCt();
                    {
                        productTypes.Value = "CDS";
                        product.ProductTypes.Add(productTypes);
                    }
                    trade.Product = product;
                }
                {
                    var documentation = new Tns.DocumentationCt();
                    {
                        var masterConfirmation = new Tns.MasterConfirmationCt();
                        masterConfirmation.MasterConfirmationType.Value = "ISDA2003StandardCreditNorthAmerican";
                        masterConfirmation.MasterConfirmationDate = new LxDateTime(LxDateTimeType.Date, 2009, 5, 22, 0, 0, 0, 0, 0, 0, false);
                        documentation.MasterConfirmation = masterConfirmation;
                    }
                    trade.Documentation = documentation;
                }
                executionAdviceElm.Trade = trade;
            }
            var parties = new Tns.PartyCt();
            {
                parties.Id = "_fund";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "IMGRUS6S";
                    parties.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "INVEST MGR";
                    parties.PartyName = partyName;
                }
                executionAdviceElm.Parties.Add(parties);
            }
            var parties1 = new Tns.PartyCt();
            {
                parties1.Id = "_broker";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "BROKUS33";
                    parties1.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "BROKER 33";
                    parties1.PartyName = partyName;
                }
                executionAdviceElm.Parties.Add(parties1);
            }
            var parties2 = new Tns.PartyCt();
            {
                parties2.Id = "_cust";
                var partyIds = new Tns.PartyIdCt();
                {
                    partyIds.Value = "CUSTUS3T";
                    parties2.PartyIds.Add(partyIds);
                }
                {
                    var partyName = new Tns.PartyNameCt();
                    partyName.Value = "Custodian";
                    parties2.PartyName = partyName;
                }
                executionAdviceElm.Parties.Add(parties2);
            }
            var accounts = new Tns.AccountCt();
            {
                accounts.Id = "_FUNDACCT";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.AccountIdScheme = "http://www.imgr.com/schemes/account-id";
                    accountIds.Value = "FUND100";
                    accounts.AccountIds.Add(accountIds);
                }
                {
                    var accountBeneficiary = new Tns.PartyReferenceCt();
                    accountBeneficiary.Href = "_fund";
                    accounts.AccountBeneficiary = accountBeneficiary;
                }
                executionAdviceElm.Accounts.Add(accounts);
            }
            var accounts1 = new Tns.AccountCt();
            {
                accounts1.Id = "_CUSTACCT";
                var accountIds = new Tns.AccountIdCt();
                {
                    accountIds.AccountIdScheme = "http://www.custodian.com/account-id";
                    accountIds.Value = "98765";
                    accounts1.AccountIds.Add(accountIds);
                }
                {
                    var accountBeneficiary = new Tns.PartyReferenceCt();
                    accountBeneficiary.Href = "_cust";
                    accounts1.AccountBeneficiary = accountBeneficiary;
                }
                executionAdviceElm.Accounts.Add(accounts1);
            }
            executionAdviceElm.IsCorrection = false;
            executionAdviceElm.CorrelationId.CorrelationIdScheme = "http://www.imgr.com/schemes/correlation-id";
            executionAdviceElm.CorrelationId.Value = "IM/C001";
            executionAdviceElm.SequenceNumber = System.Numerics.BigInteger.Parse("1");
            executionAdviceElm.Header.SentBy.Value = "IMGRUS6S";
            var sendTos = new Tns.MessageAddressCt();
            {
                sendTos.Value = "CUSTUS3T";
                executionAdviceElm.Header.SendTos.Add(sendTos);
            }
            executionAdviceElm.Header.CreationTimestamp = new LxDateTime(LxDateTimeType.DateTime, 2009, 6, 8, 10, 3, 9, 0, 0, 0, -8, 0);
            executionAdviceElm.Header.MessageId.MessageIdScheme = "http://www.imgr.com/schemes/message-id";
            executionAdviceElm.Header.MessageId.Value = "IM/5";
            executionAdviceElm.FpmlVersion = Ns.FpmlVersionEnum.N5_0;


            var serializer = new LxSerializer<Tns.ExecutionAdviceElm>();
            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, executionAdviceElm);
                return writer.ToString();
            }
            #endregion
        }
    }
}
<?xml version="1.0" encoding="utf-8"?>
<!--View is confirmation-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/confirmation-->
<!--
  == Copyright (c) 2002-2010. All rights reserved.
  == Financial Products Markup Language is subject to the FpML public license.
  == A copy of this license is available at http://www.fpml.org/documents/license
  -->
<!--View is reporting-->
<!--Version is 5-0-->
<!--NS is http://www.fpml.org/FpML-5/reporting-->
<!--Omit some adjustments, details of procedures, and other information not required for a report-->
<!--5.0:Message type is a Root of the message-->
<!--5.0 Messaging: changed <contractCreated> -><executionAdvice>-->
<!--executionAdvice xmlns="http://www.fpml.org/FpML-5/reporting" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/reporting ../../fpml-main-5-0.xsd"-->
<executionAdvice xmlns="http://www.fpml.org/FpML-5/confirmation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fpmlVersion="5-0" xsi:schemaLocation="http://www.fpml.org/FpML-5/confirmation ../../fpml-main-5-0.xsd">
  <header>
<!--5.0: conversationId added-->
<!--5.0 Messaging: <correlationId> is used instead of <conversationId>-->
<!--conversationId conversationIdScheme="http://www.imgr.com/schemes/conversation-id">IM/C001</conversationId-->
    <messageId messageIdScheme="http://www.imgr.com/schemes/message-id">IM/5</messageId>
    <sentBy>IMGRUS6S</sentBy>
    <sendTo>CUSTUS3T</sendTo>
    <creationTimestamp>2009-06-08T10:03:09.000-08:00</creationTimestamp>
  </header>
<!--5.0: tradeReference - added - Do you need it in this conversation?-->
<!--5.0 Messaging: added
                <isCorrection>
                <correlationId>
                <sequenceNumber>
        -->
  <isCorrection>false</isCorrection>
  <correlationId correlationIdScheme="http://www.imgr.com/schemes/correlation-id">IM/C001</correlationId>
  <sequenceNumber>1</sequenceNumber>
<!--5.0 Messaging: <contract> substituted by a choice
                <trade>
                <amendment>
                <increase>
                <novation>
                <termination>
        -->
  <trade>
<!--5.0 Messaging: change  <header> -> <tradeHeader>-->
    <tradeHeader>
<!--FpML 5.0 Renamed from "identifier" to "partyTradeIdentifier"-->
      <partyTradeIdentifier>
        <partyReference href="_fund" />
<!--5.0 Messaging: change  <versionedContractId> -> <versionedTradeId>-->
        <versionedTradeId>
<!--5.0 Messaging: change  <contractId contractIdScheme=""> -> <tradeId tradeIdScheme="">-->
          <tradeId tradeIdScheme="http://www.swift.com/coding-scheme/contract-id">CONTR2345</tradeId>
          <version>1</version>
        </versionedTradeId>
      </partyTradeIdentifier>
<!--5.0: changed <contractDate> -<tradeDate>-->
      <tradeDate>2009-06-08</tradeDate>
    </tradeHeader>
    <creditDefaultSwap>
      <productType>CDS</productType>
      <generalTerms>
        <effectiveDate>
          <unadjustedDate>2009-06-09</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCentersReference href="BCNYLO" />
          </dateAdjustments>
        </effectiveDate>
        <scheduledTerminationDate>
<!--5.0: Removed <adjustableDate> container -->
          <unadjustedDate>2012-06-20</unadjustedDate>
          <dateAdjustments>
            <businessDayConvention>FOLLOWING</businessDayConvention>
            <businessCenters id="BCNYLO">
              <businessCenter>USNY</businessCenter>
              <businessCenter>GBLO</businessCenter>
            </businessCenters>
          </dateAdjustments>
        </scheduledTerminationDate>
<!--FpML 5.0: Messaging: buyerPartyReference moved a head sellerPartyReference-->
        <buyerPartyReference href="_broker" />
        <sellerPartyReference href="_fund" />
        <referenceInformation>
          <referenceEntity>
            <entityName>0E69A8</entityName>
            <entityId entityIdScheme="http://www.fpml.com/spec/2003/entity-id-RED-1-0">0E69A8</entityId>
          </referenceEntity>
          <referenceObligation>
            <bond>
              <instrumentId instrumentIdScheme="http://www.fpml.org/spec/2002/instrument-id-ISIN-1-0">US042735AL41</instrumentId>
            </bond>
            <primaryObligor>
              <entityName>ARW</entityName>
              <entityId entityIdScheme="http://www.imgr.com/schemes/entity-id">ARW</entityId>
            </primaryObligor>
          </referenceObligation>
          <allGuarantees>true</allGuarantees>
          <referencePrice>87.4</referencePrice>
        </referenceInformation>
      </generalTerms>
      <feeLeg>
        <initialPayment>
          <payerPartyReference href="_fund" />
          <receiverPartyReference href="_broker" />
          <paymentAmount>
            <currency>USD</currency>
            <amount>387300.00</amount>
          </paymentAmount>
        </initialPayment>
        <periodicPayment>
          <paymentFrequency>
            <periodMultiplier>3</periodMultiplier>
            <period>M</period>
          </paymentFrequency>
          <firstPeriodStartDate>2009-03-20</firstPeriodStartDate>
          <firstPaymentDate>2009-06-20</firstPaymentDate>
          <rollConvention>20</rollConvention>
          <fixedAmountCalculation>
            <calculationAmount>
              <currency>USD</currency>
              <amount>70000000.00</amount>
            </calculationAmount>
            <fixedRate>0.023</fixedRate>
            <dayCountFraction>ACT/360</dayCountFraction>
          </fixedAmountCalculation>
        </periodicPayment>
      </feeLeg>
      <protectionTerms>
        <calculationAmount id="calculationAmount">
          <currency>USD</currency>
          <amount>70000000.00</amount>
        </calculationAmount>
        <creditEvents>
<!--5.0 product: "bankruptcy" element's type changed from empty -> Boolean-->
          <bankruptcy>true</bankruptcy>
          <failureToPay>
<!--5.0: Added Boolean element "applicable"-->
            <applicable>true</applicable>
            <paymentRequirement>
              <currency>USD</currency>
              <amount>1000000.00</amount>
            </paymentRequirement>
          </failureToPay>
<!--5.0 product: "obligationAcceleration" element's type changed from empty -> Boolean-->
          <obligationAcceleration>true</obligationAcceleration>
<!--5.0 product "repudiationMoratorium" element's type changed from empty -> Boolean-->
          <repudiationMoratorium>true</repudiationMoratorium>
          <restructuring>
<!--5.0 product: Added Boolean element "applicable"-->
            <applicable>true</applicable>
            <restructuringType>ModR</restructuringType>
          </restructuring>
          <creditEventNotice>
            <notifyingParty>
              <buyerPartyReference href="_broker" />
            </notifyingParty>
            <publiclyAvailableInformation>
<!--5.0 product:  "standardPublicSources" element's type changed from empty -> Boolean-->
              <standardPublicSources>true</standardPublicSources>
              <specifiedNumber>2</specifiedNumber>
            </publiclyAvailableInformation>
          </creditEventNotice>
        </creditEvents>
        <obligations>
          <category>Bond</category>
<!--5.0 Product: "notSubordinated" element's type changed from empty -> Boolean-->
          <notSubordinated>true</notSubordinated>
<!--5.0 Product: "notDomesticCurrency" element became a container. Added Boolean element "applicable"-->
          <notDomesticCurrency>
            <applicable>true</applicable>
          </notDomesticCurrency>
<!--5.0 product: "notDomesticLaw" element's type changed empty -> Boolean-->
          <notDomesticLaw>true</notDomesticLaw>
<!--5.0 product: "notDomesticIssuance" element's type changed from empty -> Boolean-->
          <notDomesticIssuance>true</notDomesticIssuance>
        </obligations>
      </protectionTerms>
      <physicalSettlementTerms>
        <settlementCurrency>USD</settlementCurrency>
        <physicalSettlementPeriod>
<!--5.0 product: "businessDaysNotSpecified" element's type changed from empty -> Boolean-->
          <businessDaysNotSpecified>true</businessDaysNotSpecified>
        </physicalSettlementPeriod>
        <deliverableObligations>
          <accruedInterest>false</accruedInterest>
          <category>Bond</category>
<!--5.0 product: "notSubordinated" element's type changed from empty -> Boolean-->
          <notSubordinated>true</notSubordinated>
<!--5.0 product: "specifiedCurrency" element became a container. Added Boolean element "applicable"-->
          <specifiedCurrency>
            <applicable>true</applicable>
          </specifiedCurrency>
<!--5.0 product: "notDomesticLaw" element's type changed from empty -> Boolean-->
          <notDomesticLaw>true</notDomesticLaw>
<!--5.0 product: "notContingent" element's type changed from empty -> Boolean-->
          <notContingent>true</notContingent>
<!--5.0 product: "notDomesticIssuance" element's type changed from empty -> Boolean-->
          <notDomesticIssuance>true</notDomesticIssuance>
<!--5.0 product "transferable" element's type changed from empty -> Boolean-->
          <transferable>true</transferable>
<!--5.0 product: "notBearer" element's type changed from empty -> Boolean-->
          <notBearer>true</notBearer>
        </deliverableObligations>
        <escrow>true</escrow>
      </physicalSettlementTerms>
    </creditDefaultSwap>
    <documentation>
      <masterConfirmation>
        <masterConfirmationType>ISDA2003StandardCreditNorthAmerican</masterConfirmationType>
        <masterConfirmationDate>2009-05-22</masterConfirmationDate>
      </masterConfirmation>
    </documentation>
  </trade>
  <party id="_fund">
    <partyId>IMGRUS6S</partyId>
    <partyName>INVEST MGR</partyName>
  </party>
  <party id="_broker">
    <partyId>BROKUS33</partyId>
    <partyName>BROKER 33</partyName>
  </party>
  <party id="_cust">
    <partyId>CUSTUS3T</partyId>
    <partyName>Custodian</partyName>
  </party>
  <account id="_FUNDACCT">
    <accountId accountIdScheme="http://www.imgr.com/schemes/account-id">FUND100</accountId>
    <accountBeneficiary href="_fund" />
  </account>
  <account id="_CUSTACCT">
    <accountId accountIdScheme="http://www.custodian.com/account-id">98765</accountId>
    <accountBeneficiary href="_cust" />
  </account>
</executionAdvice>

Video Tutorial

This video tutorial demonstrates the basic usage of the XML Objects tool, showing how to generate code from an XSD, read an XML document into the object model, modify the data and write out the XML.

Like what you see? Try Liquid Studio Free Free Trial