public FloatingLegCalculation(XmlNode xmlNode)
 {
     XmlNode pricingDatesNode = xmlNode.SelectSingleNode("pricingDates");
     
     if (pricingDatesNode != null)
     {
         if (pricingDatesNode.Attributes["href"] != null || pricingDatesNode.Attributes["id"] != null) 
         {
             if (pricingDatesNode.Attributes["id"] != null) 
             {
                 pricingDatesIDRef_ = pricingDatesNode.Attributes["id"].Value;
                 CommodityPricingDates ob = new CommodityPricingDates(pricingDatesNode);
                 IDManager.SetID(pricingDatesIDRef_, ob);
             }
             else if (pricingDatesNode.Attributes["href"] != null)
             {
                 pricingDatesIDRef_ = pricingDatesNode.Attributes["href"].Value;
             }
             else
             {
                 pricingDates_ = new CommodityPricingDates(pricingDatesNode);
             }
         }
         else
         {
             pricingDates_ = new CommodityPricingDates(pricingDatesNode);
         }
     }
     
 
     XmlNode averagingMethodNode = xmlNode.SelectSingleNode("averagingMethod");
     
     if (averagingMethodNode != null)
     {
         if (averagingMethodNode.Attributes["href"] != null || averagingMethodNode.Attributes["id"] != null) 
         {
             if (averagingMethodNode.Attributes["id"] != null) 
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["id"].Value;
                 AveragingMethodEnum ob = new AveragingMethodEnum(averagingMethodNode);
                 IDManager.SetID(averagingMethodIDRef_, ob);
             }
             else if (averagingMethodNode.Attributes["href"] != null)
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["href"].Value;
             }
             else
             {
                 averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
             }
         }
         else
         {
             averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
         }
     }
     
 
     XmlNode conversionFactorNode = xmlNode.SelectSingleNode("conversionFactor");
     
     if (conversionFactorNode != null)
     {
         if (conversionFactorNode.Attributes["href"] != null || conversionFactorNode.Attributes["id"] != null) 
         {
             if (conversionFactorNode.Attributes["id"] != null) 
             {
                 conversionFactorIDRef_ = conversionFactorNode.Attributes["id"].Value;
                 XsdTypeDecimal ob = new XsdTypeDecimal(conversionFactorNode);
                 IDManager.SetID(conversionFactorIDRef_, ob);
             }
             else if (conversionFactorNode.Attributes["href"] != null)
             {
                 conversionFactorIDRef_ = conversionFactorNode.Attributes["href"].Value;
             }
             else
             {
                 conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
             }
         }
         else
         {
             conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
         }
     }
     
 
     XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");
     
     if (roundingNode != null)
     {
         if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) 
         {
             if (roundingNode.Attributes["id"] != null) 
             {
                 roundingIDRef_ = roundingNode.Attributes["id"].Value;
                 Rounding ob = new Rounding(roundingNode);
                 IDManager.SetID(roundingIDRef_, ob);
             }
             else if (roundingNode.Attributes["href"] != null)
             {
                 roundingIDRef_ = roundingNode.Attributes["href"].Value;
             }
             else
             {
                 rounding_ = new Rounding(roundingNode);
             }
         }
         else
         {
             rounding_ = new Rounding(roundingNode);
         }
     }
     
 
     XmlNode spreadNode = xmlNode.SelectSingleNode("spread");
     
     if (spreadNode != null)
     {
         if (spreadNode.Attributes["href"] != null || spreadNode.Attributes["id"] != null) 
         {
             if (spreadNode.Attributes["id"] != null) 
             {
                 spreadIDRef_ = spreadNode.Attributes["id"].Value;
                 CommoditySpread ob = new CommoditySpread(spreadNode);
                 IDManager.SetID(spreadIDRef_, ob);
             }
             else if (spreadNode.Attributes["href"] != null)
             {
                 spreadIDRef_ = spreadNode.Attributes["href"].Value;
             }
             else
             {
                 spread_ = new CommoditySpread(spreadNode);
             }
         }
         else
         {
             spread_ = new CommoditySpread(spreadNode);
         }
     }
     
 
     XmlNodeList spreadScheduleNodeList = xmlNode.SelectNodes("spreadSchedule");
     
     if (spreadScheduleNodeList != null)
     {
         this.spreadSchedule_ = new List<CommoditySpreadSchedule>();
         foreach (XmlNode item in spreadScheduleNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     spreadScheduleIDRef_ = item.Attributes["id"].Value;
                     spreadSchedule_.Add(new CommoditySpreadSchedule(item));
                     IDManager.SetID(spreadScheduleIDRef_, spreadSchedule_[spreadSchedule_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     spreadScheduleIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 spreadSchedule_.Add(new CommoditySpreadSchedule(item));
                 }
             }
             else
             {
                 spreadSchedule_.Add(new CommoditySpreadSchedule(item));
             }
         }
     }
     
 
     XmlNode spreadPercentageNode = xmlNode.SelectSingleNode("spreadPercentage");
     
     if (spreadPercentageNode != null)
     {
         if (spreadPercentageNode.Attributes["href"] != null || spreadPercentageNode.Attributes["id"] != null) 
         {
             if (spreadPercentageNode.Attributes["id"] != null) 
             {
                 spreadPercentageIDRef_ = spreadPercentageNode.Attributes["id"].Value;
                 XsdTypeDecimal ob = new XsdTypeDecimal(spreadPercentageNode);
                 IDManager.SetID(spreadPercentageIDRef_, ob);
             }
             else if (spreadPercentageNode.Attributes["href"] != null)
             {
                 spreadPercentageIDRef_ = spreadPercentageNode.Attributes["href"].Value;
             }
             else
             {
                 spreadPercentage_ = new XsdTypeDecimal(spreadPercentageNode);
             }
         }
         else
         {
             spreadPercentage_ = new XsdTypeDecimal(spreadPercentageNode);
         }
     }
     
 
     XmlNode fxNode = xmlNode.SelectSingleNode("fx");
     
     if (fxNode != null)
     {
         if (fxNode.Attributes["href"] != null || fxNode.Attributes["id"] != null) 
         {
             if (fxNode.Attributes["id"] != null) 
             {
                 fxIDRef_ = fxNode.Attributes["id"].Value;
                 CommodityFx ob = new CommodityFx(fxNode);
                 IDManager.SetID(fxIDRef_, ob);
             }
             else if (fxNode.Attributes["href"] != null)
             {
                 fxIDRef_ = fxNode.Attributes["href"].Value;
             }
             else
             {
                 fx_ = new CommodityFx(fxNode);
             }
         }
         else
         {
             fx_ = new CommodityFx(fxNode);
         }
     }
     
 
 }
Пример #2
0
        public FloatingLegCalculation(XmlNode xmlNode)
        {
            XmlNodeList pricingDatesNodeList = xmlNode.SelectNodes("pricingDates");

            if (pricingDatesNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in pricingDatesNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        pricingDatesIDRef = item.Attributes["id"].Name;
                        CommodityPricingDates ob = CommodityPricingDates();
                        IDManager.SetID(pricingDatesIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        pricingDatesIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        pricingDates = new CommodityPricingDates(item);
                    }
                }
            }


            XmlNodeList averagingMethodNodeList = xmlNode.SelectNodes("averagingMethod");

            if (averagingMethodNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in averagingMethodNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        averagingMethodIDRef = item.Attributes["id"].Name;
                        AveragingMethodEnum ob = AveragingMethodEnum();
                        IDManager.SetID(averagingMethodIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        averagingMethodIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        averagingMethod = new AveragingMethodEnum(item);
                    }
                }
            }


            XmlNodeList conversionFactorNodeList = xmlNode.SelectNodes("conversionFactor");

            if (conversionFactorNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in conversionFactorNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        conversionFactorIDRef = item.Attributes["id"].Name;
                        XsdTypeDecimal ob = XsdTypeDecimal();
                        IDManager.SetID(conversionFactorIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        conversionFactorIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        conversionFactor = new XsdTypeDecimal(item);
                    }
                }
            }


            XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");

            if (roundingNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in roundingNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        roundingIDRef = item.Attributes["id"].Name;
                        Rounding ob = Rounding();
                        IDManager.SetID(roundingIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        roundingIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        rounding = new Rounding(item);
                    }
                }
            }


            XmlNodeList spreadNodeList = xmlNode.SelectNodes("spread");

            if (spreadNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in spreadNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        spreadIDRef = item.Attributes["id"].Name;
                        CommoditySpread ob = CommoditySpread();
                        IDManager.SetID(spreadIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        spreadIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        spread = new CommoditySpread(item);
                    }
                }
            }


            XmlNodeList spreadScheduleNodeList = xmlNode.SelectNodes("spreadSchedule");

            foreach (XmlNode item in spreadScheduleNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        spreadScheduleIDRef = item.Attributes["id"].Name;
                        List <CommoditySpreadSchedule> ob = new List <CommoditySpreadSchedule>();
                        ob.Add(new CommoditySpreadSchedule(item));
                        IDManager.SetID(spreadScheduleIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        spreadScheduleIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        spreadSchedule.Add(new CommoditySpreadSchedule(item));
                    }
                }
            }


            XmlNodeList spreadPercentageNodeList = xmlNode.SelectNodes("spreadPercentage");

            if (spreadPercentageNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in spreadPercentageNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        spreadPercentageIDRef = item.Attributes["id"].Name;
                        XsdTypeDecimal ob = XsdTypeDecimal();
                        IDManager.SetID(spreadPercentageIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        spreadPercentageIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        spreadPercentage = new XsdTypeDecimal(item);
                    }
                }
            }


            XmlNodeList fxNodeList = xmlNode.SelectNodes("fx");

            if (fxNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in fxNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fxIDRef = item.Attributes["id"].Name;
                        CommodityFx ob = CommodityFx();
                        IDManager.SetID(fxIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fxIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fx = new CommodityFx(item);
                    }
                }
            }
        }
        public CommodityExercise(XmlNode xmlNode)
        {
            XmlNode americanExerciseNode = xmlNode.SelectSingleNode("americanExercise");

            if (americanExerciseNode != null)
            {
                if (americanExerciseNode.Attributes["href"] != null || americanExerciseNode.Attributes["id"] != null)
                {
                    if (americanExerciseNode.Attributes["id"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["id"].Value;
                        CommodityAmericanExercise ob = new CommodityAmericanExercise(americanExerciseNode);
                        IDManager.SetID(americanExerciseIDRef_, ob);
                    }
                    else if (americanExerciseNode.Attributes["href"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        americanExercise_ = new CommodityAmericanExercise(americanExerciseNode);
                    }
                }
                else
                {
                    americanExercise_ = new CommodityAmericanExercise(americanExerciseNode);
                }
            }


            XmlNode europeanExerciseNode = xmlNode.SelectSingleNode("europeanExercise");

            if (europeanExerciseNode != null)
            {
                if (europeanExerciseNode.Attributes["href"] != null || europeanExerciseNode.Attributes["id"] != null)
                {
                    if (europeanExerciseNode.Attributes["id"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["id"].Value;
                        CommodityEuropeanExercise ob = new CommodityEuropeanExercise(europeanExerciseNode);
                        IDManager.SetID(europeanExerciseIDRef_, ob);
                    }
                    else if (europeanExerciseNode.Attributes["href"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        europeanExercise_ = new CommodityEuropeanExercise(europeanExerciseNode);
                    }
                }
                else
                {
                    europeanExercise_ = new CommodityEuropeanExercise(europeanExerciseNode);
                }
            }


            XmlNode automaticExerciseNode = xmlNode.SelectSingleNode("automaticExercise");

            if (automaticExerciseNode != null)
            {
                if (automaticExerciseNode.Attributes["href"] != null || automaticExerciseNode.Attributes["id"] != null)
                {
                    if (automaticExerciseNode.Attributes["id"] != null)
                    {
                        automaticExerciseIDRef_ = automaticExerciseNode.Attributes["id"].Value;
                        XsdTypeBoolean ob = new XsdTypeBoolean(automaticExerciseNode);
                        IDManager.SetID(automaticExerciseIDRef_, ob);
                    }
                    else if (automaticExerciseNode.Attributes["href"] != null)
                    {
                        automaticExerciseIDRef_ = automaticExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        automaticExercise_ = new XsdTypeBoolean(automaticExerciseNode);
                    }
                }
                else
                {
                    automaticExercise_ = new XsdTypeBoolean(automaticExerciseNode);
                }
            }


            XmlNode writtenConfirmationNode = xmlNode.SelectSingleNode("writtenConfirmation");

            if (writtenConfirmationNode != null)
            {
                if (writtenConfirmationNode.Attributes["href"] != null || writtenConfirmationNode.Attributes["id"] != null)
                {
                    if (writtenConfirmationNode.Attributes["id"] != null)
                    {
                        writtenConfirmationIDRef_ = writtenConfirmationNode.Attributes["id"].Value;
                        XsdTypeBoolean ob = new XsdTypeBoolean(writtenConfirmationNode);
                        IDManager.SetID(writtenConfirmationIDRef_, ob);
                    }
                    else if (writtenConfirmationNode.Attributes["href"] != null)
                    {
                        writtenConfirmationIDRef_ = writtenConfirmationNode.Attributes["href"].Value;
                    }
                    else
                    {
                        writtenConfirmation_ = new XsdTypeBoolean(writtenConfirmationNode);
                    }
                }
                else
                {
                    writtenConfirmation_ = new XsdTypeBoolean(writtenConfirmationNode);
                }
            }


            XmlNode settlementCurrencyNode = xmlNode.SelectSingleNode("settlementCurrency");

            if (settlementCurrencyNode != null)
            {
                if (settlementCurrencyNode.Attributes["href"] != null || settlementCurrencyNode.Attributes["id"] != null)
                {
                    if (settlementCurrencyNode.Attributes["id"] != null)
                    {
                        settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["id"].Value;
                        IdentifiedCurrency ob = new IdentifiedCurrency(settlementCurrencyNode);
                        IDManager.SetID(settlementCurrencyIDRef_, ob);
                    }
                    else if (settlementCurrencyNode.Attributes["href"] != null)
                    {
                        settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
                    }
                }
                else
                {
                    settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
                }
            }


            XmlNode fxNode = xmlNode.SelectSingleNode("fx");

            if (fxNode != null)
            {
                if (fxNode.Attributes["href"] != null || fxNode.Attributes["id"] != null)
                {
                    if (fxNode.Attributes["id"] != null)
                    {
                        fxIDRef_ = fxNode.Attributes["id"].Value;
                        CommodityFx ob = new CommodityFx(fxNode);
                        IDManager.SetID(fxIDRef_, ob);
                    }
                    else if (fxNode.Attributes["href"] != null)
                    {
                        fxIDRef_ = fxNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fx_ = new CommodityFx(fxNode);
                    }
                }
                else
                {
                    fx_ = new CommodityFx(fxNode);
                }
            }


            XmlNode conversionFactorNode = xmlNode.SelectSingleNode("conversionFactor");

            if (conversionFactorNode != null)
            {
                if (conversionFactorNode.Attributes["href"] != null || conversionFactorNode.Attributes["id"] != null)
                {
                    if (conversionFactorNode.Attributes["id"] != null)
                    {
                        conversionFactorIDRef_ = conversionFactorNode.Attributes["id"].Value;
                        XsdTypeDecimal ob = new XsdTypeDecimal(conversionFactorNode);
                        IDManager.SetID(conversionFactorIDRef_, ob);
                    }
                    else if (conversionFactorNode.Attributes["href"] != null)
                    {
                        conversionFactorIDRef_ = conversionFactorNode.Attributes["href"].Value;
                    }
                    else
                    {
                        conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
                    }
                }
                else
                {
                    conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
                }
            }


            XmlNode relativePaymentDatesNode = xmlNode.SelectSingleNode("relativePaymentDates");

            if (relativePaymentDatesNode != null)
            {
                if (relativePaymentDatesNode.Attributes["href"] != null || relativePaymentDatesNode.Attributes["id"] != null)
                {
                    if (relativePaymentDatesNode.Attributes["id"] != null)
                    {
                        relativePaymentDatesIDRef_ = relativePaymentDatesNode.Attributes["id"].Value;
                        CommodityRelativePaymentDates ob = new CommodityRelativePaymentDates(relativePaymentDatesNode);
                        IDManager.SetID(relativePaymentDatesIDRef_, ob);
                    }
                    else if (relativePaymentDatesNode.Attributes["href"] != null)
                    {
                        relativePaymentDatesIDRef_ = relativePaymentDatesNode.Attributes["href"].Value;
                    }
                    else
                    {
                        relativePaymentDates_ = new CommodityRelativePaymentDates(relativePaymentDatesNode);
                    }
                }
                else
                {
                    relativePaymentDates_ = new CommodityRelativePaymentDates(relativePaymentDatesNode);
                }
            }


            XmlNode paymentDatesNode = xmlNode.SelectSingleNode("paymentDates");

            if (paymentDatesNode != null)
            {
                if (paymentDatesNode.Attributes["href"] != null || paymentDatesNode.Attributes["id"] != null)
                {
                    if (paymentDatesNode.Attributes["id"] != null)
                    {
                        paymentDatesIDRef_ = paymentDatesNode.Attributes["id"].Value;
                        AdjustableDatesOrRelativeDateOffset ob = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
                        IDManager.SetID(paymentDatesIDRef_, ob);
                    }
                    else if (paymentDatesNode.Attributes["href"] != null)
                    {
                        paymentDatesIDRef_ = paymentDatesNode.Attributes["href"].Value;
                    }
                    else
                    {
                        paymentDates_ = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
                    }
                }
                else
                {
                    paymentDates_ = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
                }
            }


            XmlNode masterAgreementPaymentDatesNode = xmlNode.SelectSingleNode("masterAgreementPaymentDates");

            if (masterAgreementPaymentDatesNode != null)
            {
                if (masterAgreementPaymentDatesNode.Attributes["href"] != null || masterAgreementPaymentDatesNode.Attributes["id"] != null)
                {
                    if (masterAgreementPaymentDatesNode.Attributes["id"] != null)
                    {
                        masterAgreementPaymentDatesIDRef_ = masterAgreementPaymentDatesNode.Attributes["id"].Value;
                        XsdTypeBoolean ob = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
                        IDManager.SetID(masterAgreementPaymentDatesIDRef_, ob);
                    }
                    else if (masterAgreementPaymentDatesNode.Attributes["href"] != null)
                    {
                        masterAgreementPaymentDatesIDRef_ = masterAgreementPaymentDatesNode.Attributes["href"].Value;
                    }
                    else
                    {
                        masterAgreementPaymentDates_ = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
                    }
                }
                else
                {
                    masterAgreementPaymentDates_ = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
                }
            }
        }
Пример #4
0
        public CommodityExercise(XmlNode xmlNode)
        {
            XmlNodeList americanExerciseNodeList = xmlNode.SelectNodes("americanExercise");

            if (americanExerciseNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in americanExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        americanExerciseIDRef = item.Attributes["id"].Name;
                        CommodityAmericanExercise ob = CommodityAmericanExercise();
                        IDManager.SetID(americanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        americanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        americanExercise = new CommodityAmericanExercise(item);
                    }
                }
            }


            XmlNodeList europeanExerciseNodeList = xmlNode.SelectNodes("europeanExercise");

            if (europeanExerciseNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in europeanExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        europeanExerciseIDRef = item.Attributes["id"].Name;
                        CommodityEuropeanExercise ob = CommodityEuropeanExercise();
                        IDManager.SetID(europeanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        europeanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        europeanExercise = new CommodityEuropeanExercise(item);
                    }
                }
            }


            XmlNodeList automaticExerciseNodeList = xmlNode.SelectNodes("automaticExercise");

            if (automaticExerciseNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in automaticExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        automaticExerciseIDRef = item.Attributes["id"].Name;
                        XsdTypeBoolean ob = XsdTypeBoolean();
                        IDManager.SetID(automaticExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        automaticExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        automaticExercise = new XsdTypeBoolean(item);
                    }
                }
            }


            XmlNodeList writtenConfirmationNodeList = xmlNode.SelectNodes("writtenConfirmation");

            if (writtenConfirmationNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in writtenConfirmationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        writtenConfirmationIDRef = item.Attributes["id"].Name;
                        XsdTypeBoolean ob = XsdTypeBoolean();
                        IDManager.SetID(writtenConfirmationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        writtenConfirmationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        writtenConfirmation = new XsdTypeBoolean(item);
                    }
                }
            }


            XmlNodeList settlementCurrencyNodeList = xmlNode.SelectNodes("settlementCurrency");

            if (settlementCurrencyNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in settlementCurrencyNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementCurrencyIDRef = item.Attributes["id"].Name;
                        IdentifiedCurrency ob = IdentifiedCurrency();
                        IDManager.SetID(settlementCurrencyIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementCurrencyIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementCurrency = new IdentifiedCurrency(item);
                    }
                }
            }


            XmlNodeList fxNodeList = xmlNode.SelectNodes("fx");

            if (fxNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in fxNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fxIDRef = item.Attributes["id"].Name;
                        CommodityFx ob = CommodityFx();
                        IDManager.SetID(fxIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fxIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fx = new CommodityFx(item);
                    }
                }
            }


            XmlNodeList conversionFactorNodeList = xmlNode.SelectNodes("conversionFactor");

            if (conversionFactorNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in conversionFactorNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        conversionFactorIDRef = item.Attributes["id"].Name;
                        XsdTypeDecimal ob = XsdTypeDecimal();
                        IDManager.SetID(conversionFactorIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        conversionFactorIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        conversionFactor = new XsdTypeDecimal(item);
                    }
                }
            }


            XmlNodeList relativePaymentDatesNodeList = xmlNode.SelectNodes("relativePaymentDates");

            if (relativePaymentDatesNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in relativePaymentDatesNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        relativePaymentDatesIDRef = item.Attributes["id"].Name;
                        CommodityRelativePaymentDates ob = CommodityRelativePaymentDates();
                        IDManager.SetID(relativePaymentDatesIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        relativePaymentDatesIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        relativePaymentDates = new CommodityRelativePaymentDates(item);
                    }
                }
            }


            XmlNodeList paymentDatesNodeList = xmlNode.SelectNodes("paymentDates");

            if (paymentDatesNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in paymentDatesNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        paymentDatesIDRef = item.Attributes["id"].Name;
                        AdjustableDatesOrRelativeDateOffset ob = AdjustableDatesOrRelativeDateOffset();
                        IDManager.SetID(paymentDatesIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        paymentDatesIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        paymentDates = new AdjustableDatesOrRelativeDateOffset(item);
                    }
                }
            }


            XmlNodeList masterAgreementPaymentDatesNodeList = xmlNode.SelectNodes("masterAgreementPaymentDates");

            if (masterAgreementPaymentDatesNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in masterAgreementPaymentDatesNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        masterAgreementPaymentDatesIDRef = item.Attributes["id"].Name;
                        XsdTypeBoolean ob = XsdTypeBoolean();
                        IDManager.SetID(masterAgreementPaymentDatesIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        masterAgreementPaymentDatesIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        masterAgreementPaymentDates = new XsdTypeBoolean(item);
                    }
                }
            }
        }
 public CommodityExercise(XmlNode xmlNode)
 {
     XmlNodeList americanExerciseNodeList = xmlNode.SelectNodes("americanExercise");
     if (americanExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in americanExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 americanExerciseIDRef = item.Attributes["id"].Name;
                 CommodityAmericanExercise ob = CommodityAmericanExercise();
                 IDManager.SetID(americanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 americanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 americanExercise = new CommodityAmericanExercise(item);
             }
         }
     }
     
 
     XmlNodeList europeanExerciseNodeList = xmlNode.SelectNodes("europeanExercise");
     if (europeanExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in europeanExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 europeanExerciseIDRef = item.Attributes["id"].Name;
                 CommodityEuropeanExercise ob = CommodityEuropeanExercise();
                 IDManager.SetID(europeanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 europeanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 europeanExercise = new CommodityEuropeanExercise(item);
             }
         }
     }
     
 
     XmlNodeList automaticExerciseNodeList = xmlNode.SelectNodes("automaticExercise");
     if (automaticExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in automaticExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 automaticExerciseIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(automaticExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 automaticExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 automaticExercise = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList writtenConfirmationNodeList = xmlNode.SelectNodes("writtenConfirmation");
     if (writtenConfirmationNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in writtenConfirmationNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 writtenConfirmationIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(writtenConfirmationIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 writtenConfirmationIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 writtenConfirmation = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList settlementCurrencyNodeList = xmlNode.SelectNodes("settlementCurrency");
     if (settlementCurrencyNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementCurrencyNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementCurrencyIDRef = item.Attributes["id"].Name;
                 IdentifiedCurrency ob = IdentifiedCurrency();
                 IDManager.SetID(settlementCurrencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementCurrencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementCurrency = new IdentifiedCurrency(item);
             }
         }
     }
     
 
     XmlNodeList fxNodeList = xmlNode.SelectNodes("fx");
     if (fxNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fxNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fxIDRef = item.Attributes["id"].Name;
                 CommodityFx ob = CommodityFx();
                 IDManager.SetID(fxIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fxIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fx = new CommodityFx(item);
             }
         }
     }
     
 
     XmlNodeList conversionFactorNodeList = xmlNode.SelectNodes("conversionFactor");
     if (conversionFactorNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in conversionFactorNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 conversionFactorIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(conversionFactorIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 conversionFactorIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 conversionFactor = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList relativePaymentDatesNodeList = xmlNode.SelectNodes("relativePaymentDates");
     if (relativePaymentDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in relativePaymentDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 relativePaymentDatesIDRef = item.Attributes["id"].Name;
                 CommodityRelativePaymentDates ob = CommodityRelativePaymentDates();
                 IDManager.SetID(relativePaymentDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 relativePaymentDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 relativePaymentDates = new CommodityRelativePaymentDates(item);
             }
         }
     }
     
 
     XmlNodeList paymentDatesNodeList = xmlNode.SelectNodes("paymentDates");
     if (paymentDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in paymentDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 paymentDatesIDRef = item.Attributes["id"].Name;
                 AdjustableDatesOrRelativeDateOffset ob = AdjustableDatesOrRelativeDateOffset();
                 IDManager.SetID(paymentDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 paymentDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 paymentDates = new AdjustableDatesOrRelativeDateOffset(item);
             }
         }
     }
     
 
     XmlNodeList masterAgreementPaymentDatesNodeList = xmlNode.SelectNodes("masterAgreementPaymentDates");
     if (masterAgreementPaymentDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in masterAgreementPaymentDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 masterAgreementPaymentDatesIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(masterAgreementPaymentDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 masterAgreementPaymentDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 masterAgreementPaymentDates = new XsdTypeBoolean(item);
             }
         }
     }
     
 
 }
 public CommodityExercise(XmlNode xmlNode)
 {
     XmlNode americanExerciseNode = xmlNode.SelectSingleNode("americanExercise");
     
     if (americanExerciseNode != null)
     {
         if (americanExerciseNode.Attributes["href"] != null || americanExerciseNode.Attributes["id"] != null) 
         {
             if (americanExerciseNode.Attributes["id"] != null) 
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["id"].Value;
                 CommodityAmericanExercise ob = new CommodityAmericanExercise(americanExerciseNode);
                 IDManager.SetID(americanExerciseIDRef_, ob);
             }
             else if (americanExerciseNode.Attributes["href"] != null)
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 americanExercise_ = new CommodityAmericanExercise(americanExerciseNode);
             }
         }
         else
         {
             americanExercise_ = new CommodityAmericanExercise(americanExerciseNode);
         }
     }
     
 
     XmlNode europeanExerciseNode = xmlNode.SelectSingleNode("europeanExercise");
     
     if (europeanExerciseNode != null)
     {
         if (europeanExerciseNode.Attributes["href"] != null || europeanExerciseNode.Attributes["id"] != null) 
         {
             if (europeanExerciseNode.Attributes["id"] != null) 
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["id"].Value;
                 CommodityEuropeanExercise ob = new CommodityEuropeanExercise(europeanExerciseNode);
                 IDManager.SetID(europeanExerciseIDRef_, ob);
             }
             else if (europeanExerciseNode.Attributes["href"] != null)
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 europeanExercise_ = new CommodityEuropeanExercise(europeanExerciseNode);
             }
         }
         else
         {
             europeanExercise_ = new CommodityEuropeanExercise(europeanExerciseNode);
         }
     }
     
 
     XmlNode automaticExerciseNode = xmlNode.SelectSingleNode("automaticExercise");
     
     if (automaticExerciseNode != null)
     {
         if (automaticExerciseNode.Attributes["href"] != null || automaticExerciseNode.Attributes["id"] != null) 
         {
             if (automaticExerciseNode.Attributes["id"] != null) 
             {
                 automaticExerciseIDRef_ = automaticExerciseNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(automaticExerciseNode);
                 IDManager.SetID(automaticExerciseIDRef_, ob);
             }
             else if (automaticExerciseNode.Attributes["href"] != null)
             {
                 automaticExerciseIDRef_ = automaticExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 automaticExercise_ = new XsdTypeBoolean(automaticExerciseNode);
             }
         }
         else
         {
             automaticExercise_ = new XsdTypeBoolean(automaticExerciseNode);
         }
     }
     
 
     XmlNode writtenConfirmationNode = xmlNode.SelectSingleNode("writtenConfirmation");
     
     if (writtenConfirmationNode != null)
     {
         if (writtenConfirmationNode.Attributes["href"] != null || writtenConfirmationNode.Attributes["id"] != null) 
         {
             if (writtenConfirmationNode.Attributes["id"] != null) 
             {
                 writtenConfirmationIDRef_ = writtenConfirmationNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(writtenConfirmationNode);
                 IDManager.SetID(writtenConfirmationIDRef_, ob);
             }
             else if (writtenConfirmationNode.Attributes["href"] != null)
             {
                 writtenConfirmationIDRef_ = writtenConfirmationNode.Attributes["href"].Value;
             }
             else
             {
                 writtenConfirmation_ = new XsdTypeBoolean(writtenConfirmationNode);
             }
         }
         else
         {
             writtenConfirmation_ = new XsdTypeBoolean(writtenConfirmationNode);
         }
     }
     
 
     XmlNode settlementCurrencyNode = xmlNode.SelectSingleNode("settlementCurrency");
     
     if (settlementCurrencyNode != null)
     {
         if (settlementCurrencyNode.Attributes["href"] != null || settlementCurrencyNode.Attributes["id"] != null) 
         {
             if (settlementCurrencyNode.Attributes["id"] != null) 
             {
                 settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["id"].Value;
                 IdentifiedCurrency ob = new IdentifiedCurrency(settlementCurrencyNode);
                 IDManager.SetID(settlementCurrencyIDRef_, ob);
             }
             else if (settlementCurrencyNode.Attributes["href"] != null)
             {
                 settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
             }
             else
             {
                 settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
             }
         }
         else
         {
             settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
         }
     }
     
 
     XmlNode fxNode = xmlNode.SelectSingleNode("fx");
     
     if (fxNode != null)
     {
         if (fxNode.Attributes["href"] != null || fxNode.Attributes["id"] != null) 
         {
             if (fxNode.Attributes["id"] != null) 
             {
                 fxIDRef_ = fxNode.Attributes["id"].Value;
                 CommodityFx ob = new CommodityFx(fxNode);
                 IDManager.SetID(fxIDRef_, ob);
             }
             else if (fxNode.Attributes["href"] != null)
             {
                 fxIDRef_ = fxNode.Attributes["href"].Value;
             }
             else
             {
                 fx_ = new CommodityFx(fxNode);
             }
         }
         else
         {
             fx_ = new CommodityFx(fxNode);
         }
     }
     
 
     XmlNode conversionFactorNode = xmlNode.SelectSingleNode("conversionFactor");
     
     if (conversionFactorNode != null)
     {
         if (conversionFactorNode.Attributes["href"] != null || conversionFactorNode.Attributes["id"] != null) 
         {
             if (conversionFactorNode.Attributes["id"] != null) 
             {
                 conversionFactorIDRef_ = conversionFactorNode.Attributes["id"].Value;
                 XsdTypeDecimal ob = new XsdTypeDecimal(conversionFactorNode);
                 IDManager.SetID(conversionFactorIDRef_, ob);
             }
             else if (conversionFactorNode.Attributes["href"] != null)
             {
                 conversionFactorIDRef_ = conversionFactorNode.Attributes["href"].Value;
             }
             else
             {
                 conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
             }
         }
         else
         {
             conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
         }
     }
     
 
     XmlNode relativePaymentDatesNode = xmlNode.SelectSingleNode("relativePaymentDates");
     
     if (relativePaymentDatesNode != null)
     {
         if (relativePaymentDatesNode.Attributes["href"] != null || relativePaymentDatesNode.Attributes["id"] != null) 
         {
             if (relativePaymentDatesNode.Attributes["id"] != null) 
             {
                 relativePaymentDatesIDRef_ = relativePaymentDatesNode.Attributes["id"].Value;
                 CommodityRelativePaymentDates ob = new CommodityRelativePaymentDates(relativePaymentDatesNode);
                 IDManager.SetID(relativePaymentDatesIDRef_, ob);
             }
             else if (relativePaymentDatesNode.Attributes["href"] != null)
             {
                 relativePaymentDatesIDRef_ = relativePaymentDatesNode.Attributes["href"].Value;
             }
             else
             {
                 relativePaymentDates_ = new CommodityRelativePaymentDates(relativePaymentDatesNode);
             }
         }
         else
         {
             relativePaymentDates_ = new CommodityRelativePaymentDates(relativePaymentDatesNode);
         }
     }
     
 
     XmlNode paymentDatesNode = xmlNode.SelectSingleNode("paymentDates");
     
     if (paymentDatesNode != null)
     {
         if (paymentDatesNode.Attributes["href"] != null || paymentDatesNode.Attributes["id"] != null) 
         {
             if (paymentDatesNode.Attributes["id"] != null) 
             {
                 paymentDatesIDRef_ = paymentDatesNode.Attributes["id"].Value;
                 AdjustableDatesOrRelativeDateOffset ob = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
                 IDManager.SetID(paymentDatesIDRef_, ob);
             }
             else if (paymentDatesNode.Attributes["href"] != null)
             {
                 paymentDatesIDRef_ = paymentDatesNode.Attributes["href"].Value;
             }
             else
             {
                 paymentDates_ = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
             }
         }
         else
         {
             paymentDates_ = new AdjustableDatesOrRelativeDateOffset(paymentDatesNode);
         }
     }
     
 
     XmlNode masterAgreementPaymentDatesNode = xmlNode.SelectSingleNode("masterAgreementPaymentDates");
     
     if (masterAgreementPaymentDatesNode != null)
     {
         if (masterAgreementPaymentDatesNode.Attributes["href"] != null || masterAgreementPaymentDatesNode.Attributes["id"] != null) 
         {
             if (masterAgreementPaymentDatesNode.Attributes["id"] != null) 
             {
                 masterAgreementPaymentDatesIDRef_ = masterAgreementPaymentDatesNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
                 IDManager.SetID(masterAgreementPaymentDatesIDRef_, ob);
             }
             else if (masterAgreementPaymentDatesNode.Attributes["href"] != null)
             {
                 masterAgreementPaymentDatesIDRef_ = masterAgreementPaymentDatesNode.Attributes["href"].Value;
             }
             else
             {
                 masterAgreementPaymentDates_ = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
             }
         }
         else
         {
             masterAgreementPaymentDates_ = new XsdTypeBoolean(masterAgreementPaymentDatesNode);
         }
     }
     
 
 }
 public FloatingLegCalculation(XmlNode xmlNode)
 {
     XmlNodeList pricingDatesNodeList = xmlNode.SelectNodes("pricingDates");
     if (pricingDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in pricingDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 pricingDatesIDRef = item.Attributes["id"].Name;
                 CommodityPricingDates ob = CommodityPricingDates();
                 IDManager.SetID(pricingDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 pricingDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 pricingDates = new CommodityPricingDates(item);
             }
         }
     }
     
 
     XmlNodeList averagingMethodNodeList = xmlNode.SelectNodes("averagingMethod");
     if (averagingMethodNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in averagingMethodNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 averagingMethodIDRef = item.Attributes["id"].Name;
                 AveragingMethodEnum ob = AveragingMethodEnum();
                 IDManager.SetID(averagingMethodIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 averagingMethodIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 averagingMethod = new AveragingMethodEnum(item);
             }
         }
     }
     
 
     XmlNodeList conversionFactorNodeList = xmlNode.SelectNodes("conversionFactor");
     if (conversionFactorNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in conversionFactorNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 conversionFactorIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(conversionFactorIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 conversionFactorIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 conversionFactor = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");
     if (roundingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in roundingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 roundingIDRef = item.Attributes["id"].Name;
                 Rounding ob = Rounding();
                 IDManager.SetID(roundingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 roundingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rounding = new Rounding(item);
             }
         }
     }
     
 
     XmlNodeList spreadNodeList = xmlNode.SelectNodes("spread");
     if (spreadNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in spreadNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spreadIDRef = item.Attributes["id"].Name;
                 CommoditySpread ob = CommoditySpread();
                 IDManager.SetID(spreadIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spreadIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 spread = new CommoditySpread(item);
             }
         }
     }
     
 
     XmlNodeList spreadScheduleNodeList = xmlNode.SelectNodes("spreadSchedule");
     
     foreach (XmlNode item in spreadScheduleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spreadScheduleIDRef = item.Attributes["id"].Name;
                 List<CommoditySpreadSchedule> ob = new List<CommoditySpreadSchedule>();
                 ob.Add(new CommoditySpreadSchedule(item));
                 IDManager.SetID(spreadScheduleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spreadScheduleIDRef = item.Attributes["href"].Name;
             }
             else
             {
             spreadSchedule.Add(new CommoditySpreadSchedule(item));
             }
         }
     }
     
 
     XmlNodeList spreadPercentageNodeList = xmlNode.SelectNodes("spreadPercentage");
     if (spreadPercentageNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in spreadPercentageNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spreadPercentageIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(spreadPercentageIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spreadPercentageIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 spreadPercentage = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList fxNodeList = xmlNode.SelectNodes("fx");
     if (fxNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fxNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fxIDRef = item.Attributes["id"].Name;
                 CommodityFx ob = CommodityFx();
                 IDManager.SetID(fxIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fxIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fx = new CommodityFx(item);
             }
         }
     }
     
 
 }
        public FloatingLegCalculation(XmlNode xmlNode)
        {
            XmlNode pricingDatesNode = xmlNode.SelectSingleNode("pricingDates");

            if (pricingDatesNode != null)
            {
                if (pricingDatesNode.Attributes["href"] != null || pricingDatesNode.Attributes["id"] != null)
                {
                    if (pricingDatesNode.Attributes["id"] != null)
                    {
                        pricingDatesIDRef_ = pricingDatesNode.Attributes["id"].Value;
                        CommodityPricingDates ob = new CommodityPricingDates(pricingDatesNode);
                        IDManager.SetID(pricingDatesIDRef_, ob);
                    }
                    else if (pricingDatesNode.Attributes["href"] != null)
                    {
                        pricingDatesIDRef_ = pricingDatesNode.Attributes["href"].Value;
                    }
                    else
                    {
                        pricingDates_ = new CommodityPricingDates(pricingDatesNode);
                    }
                }
                else
                {
                    pricingDates_ = new CommodityPricingDates(pricingDatesNode);
                }
            }


            XmlNode averagingMethodNode = xmlNode.SelectSingleNode("averagingMethod");

            if (averagingMethodNode != null)
            {
                if (averagingMethodNode.Attributes["href"] != null || averagingMethodNode.Attributes["id"] != null)
                {
                    if (averagingMethodNode.Attributes["id"] != null)
                    {
                        averagingMethodIDRef_ = averagingMethodNode.Attributes["id"].Value;
                        AveragingMethodEnum ob = new AveragingMethodEnum(averagingMethodNode);
                        IDManager.SetID(averagingMethodIDRef_, ob);
                    }
                    else if (averagingMethodNode.Attributes["href"] != null)
                    {
                        averagingMethodIDRef_ = averagingMethodNode.Attributes["href"].Value;
                    }
                    else
                    {
                        averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
                    }
                }
                else
                {
                    averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
                }
            }


            XmlNode conversionFactorNode = xmlNode.SelectSingleNode("conversionFactor");

            if (conversionFactorNode != null)
            {
                if (conversionFactorNode.Attributes["href"] != null || conversionFactorNode.Attributes["id"] != null)
                {
                    if (conversionFactorNode.Attributes["id"] != null)
                    {
                        conversionFactorIDRef_ = conversionFactorNode.Attributes["id"].Value;
                        XsdTypeDecimal ob = new XsdTypeDecimal(conversionFactorNode);
                        IDManager.SetID(conversionFactorIDRef_, ob);
                    }
                    else if (conversionFactorNode.Attributes["href"] != null)
                    {
                        conversionFactorIDRef_ = conversionFactorNode.Attributes["href"].Value;
                    }
                    else
                    {
                        conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
                    }
                }
                else
                {
                    conversionFactor_ = new XsdTypeDecimal(conversionFactorNode);
                }
            }


            XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");

            if (roundingNode != null)
            {
                if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null)
                {
                    if (roundingNode.Attributes["id"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["id"].Value;
                        Rounding ob = new Rounding(roundingNode);
                        IDManager.SetID(roundingIDRef_, ob);
                    }
                    else if (roundingNode.Attributes["href"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["href"].Value;
                    }
                    else
                    {
                        rounding_ = new Rounding(roundingNode);
                    }
                }
                else
                {
                    rounding_ = new Rounding(roundingNode);
                }
            }


            XmlNode spreadNode = xmlNode.SelectSingleNode("spread");

            if (spreadNode != null)
            {
                if (spreadNode.Attributes["href"] != null || spreadNode.Attributes["id"] != null)
                {
                    if (spreadNode.Attributes["id"] != null)
                    {
                        spreadIDRef_ = spreadNode.Attributes["id"].Value;
                        CommoditySpread ob = new CommoditySpread(spreadNode);
                        IDManager.SetID(spreadIDRef_, ob);
                    }
                    else if (spreadNode.Attributes["href"] != null)
                    {
                        spreadIDRef_ = spreadNode.Attributes["href"].Value;
                    }
                    else
                    {
                        spread_ = new CommoditySpread(spreadNode);
                    }
                }
                else
                {
                    spread_ = new CommoditySpread(spreadNode);
                }
            }


            XmlNodeList spreadScheduleNodeList = xmlNode.SelectNodes("spreadSchedule");

            if (spreadScheduleNodeList != null)
            {
                this.spreadSchedule_ = new List <CommoditySpreadSchedule>();
                foreach (XmlNode item in spreadScheduleNodeList)
                {
                    if (item.Attributes["href"] != null || item.Attributes["id"] != null)
                    {
                        if (item.Attributes["id"] != null)
                        {
                            spreadScheduleIDRef_ = item.Attributes["id"].Value;
                            spreadSchedule_.Add(new CommoditySpreadSchedule(item));
                            IDManager.SetID(spreadScheduleIDRef_, spreadSchedule_[spreadSchedule_.Count - 1]);
                        }
                        else if (item.Attributes["href"] != null)
                        {
                            spreadScheduleIDRef_ = item.Attributes["href"].Value;
                        }
                        else
                        {
                            spreadSchedule_.Add(new CommoditySpreadSchedule(item));
                        }
                    }
                    else
                    {
                        spreadSchedule_.Add(new CommoditySpreadSchedule(item));
                    }
                }
            }


            XmlNode spreadPercentageNode = xmlNode.SelectSingleNode("spreadPercentage");

            if (spreadPercentageNode != null)
            {
                if (spreadPercentageNode.Attributes["href"] != null || spreadPercentageNode.Attributes["id"] != null)
                {
                    if (spreadPercentageNode.Attributes["id"] != null)
                    {
                        spreadPercentageIDRef_ = spreadPercentageNode.Attributes["id"].Value;
                        XsdTypeDecimal ob = new XsdTypeDecimal(spreadPercentageNode);
                        IDManager.SetID(spreadPercentageIDRef_, ob);
                    }
                    else if (spreadPercentageNode.Attributes["href"] != null)
                    {
                        spreadPercentageIDRef_ = spreadPercentageNode.Attributes["href"].Value;
                    }
                    else
                    {
                        spreadPercentage_ = new XsdTypeDecimal(spreadPercentageNode);
                    }
                }
                else
                {
                    spreadPercentage_ = new XsdTypeDecimal(spreadPercentageNode);
                }
            }


            XmlNode fxNode = xmlNode.SelectSingleNode("fx");

            if (fxNode != null)
            {
                if (fxNode.Attributes["href"] != null || fxNode.Attributes["id"] != null)
                {
                    if (fxNode.Attributes["id"] != null)
                    {
                        fxIDRef_ = fxNode.Attributes["id"].Value;
                        CommodityFx ob = new CommodityFx(fxNode);
                        IDManager.SetID(fxIDRef_, ob);
                    }
                    else if (fxNode.Attributes["href"] != null)
                    {
                        fxIDRef_ = fxNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fx_ = new CommodityFx(fxNode);
                    }
                }
                else
                {
                    fx_ = new CommodityFx(fxNode);
                }
            }
        }