public OptionBaseExtended(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode premiumNode = xmlNode.SelectSingleNode("premium");
     
     if (premiumNode != null)
     {
         if (premiumNode.Attributes["href"] != null || premiumNode.Attributes["id"] != null) 
         {
             if (premiumNode.Attributes["id"] != null) 
             {
                 premiumIDRef_ = premiumNode.Attributes["id"].Value;
                 Premium ob = new Premium(premiumNode);
                 IDManager.SetID(premiumIDRef_, ob);
             }
             else if (premiumNode.Attributes["href"] != null)
             {
                 premiumIDRef_ = premiumNode.Attributes["href"].Value;
             }
             else
             {
                 premium_ = new Premium(premiumNode);
             }
         }
         else
         {
             premium_ = new Premium(premiumNode);
         }
     }
     
 
     XmlNode exerciseNode = xmlNode.SelectSingleNode("exercise");
     
     if (exerciseNode != null)
     {
         if (exerciseNode.Attributes["href"] != null || exerciseNode.Attributes["id"] != null) 
         {
             if (exerciseNode.Attributes["id"] != null) 
             {
                 exerciseIDRef_ = exerciseNode.Attributes["id"].Value;
                 Exercise ob = new Exercise(exerciseNode);
                 IDManager.SetID(exerciseIDRef_, ob);
             }
             else if (exerciseNode.Attributes["href"] != null)
             {
                 exerciseIDRef_ = exerciseNode.Attributes["href"].Value;
             }
             else
             {
                 exercise_ = new Exercise(exerciseNode);
             }
         }
         else
         {
             exercise_ = new Exercise(exerciseNode);
         }
     }
     
 
     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;
                 AmericanExercise ob = new AmericanExercise(americanExerciseNode);
                 IDManager.SetID(americanExerciseIDRef_, ob);
             }
             else if (americanExerciseNode.Attributes["href"] != null)
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 americanExercise_ = new AmericanExercise(americanExerciseNode);
             }
         }
         else
         {
             americanExercise_ = new AmericanExercise(americanExerciseNode);
         }
     }
     
 
     XmlNode bermudaExerciseNode = xmlNode.SelectSingleNode("bermudaExercise");
     
     if (bermudaExerciseNode != null)
     {
         if (bermudaExerciseNode.Attributes["href"] != null || bermudaExerciseNode.Attributes["id"] != null) 
         {
             if (bermudaExerciseNode.Attributes["id"] != null) 
             {
                 bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["id"].Value;
                 BermudaExercise ob = new BermudaExercise(bermudaExerciseNode);
                 IDManager.SetID(bermudaExerciseIDRef_, ob);
             }
             else if (bermudaExerciseNode.Attributes["href"] != null)
             {
                 bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
             }
         }
         else
         {
             bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
         }
     }
     
 
     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;
                 EuropeanExercise ob = new EuropeanExercise(europeanExerciseNode);
                 IDManager.SetID(europeanExerciseIDRef_, ob);
             }
             else if (europeanExerciseNode.Attributes["href"] != null)
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
             }
         }
         else
         {
             europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
         }
     }
     
 
     XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");
     
     if (exerciseProcedureNode != null)
     {
         if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null) 
         {
             if (exerciseProcedureNode.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                 ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                 IDManager.SetID(exerciseProcedureIDRef_, ob);
             }
             else if (exerciseProcedureNode.Attributes["href"] != null)
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
             }
             else
             {
                 exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
             }
         }
         else
         {
             exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
         }
     }
     
 
     XmlNode featureNode = xmlNode.SelectSingleNode("feature");
     
     if (featureNode != null)
     {
         if (featureNode.Attributes["href"] != null || featureNode.Attributes["id"] != null) 
         {
             if (featureNode.Attributes["id"] != null) 
             {
                 featureIDRef_ = featureNode.Attributes["id"].Value;
                 OptionFeature ob = new OptionFeature(featureNode);
                 IDManager.SetID(featureIDRef_, ob);
             }
             else if (featureNode.Attributes["href"] != null)
             {
                 featureIDRef_ = featureNode.Attributes["href"].Value;
             }
             else
             {
                 feature_ = new OptionFeature(featureNode);
             }
         }
         else
         {
             feature_ = new OptionFeature(featureNode);
         }
     }
     
 
     XmlNode notionalReferenceNode = xmlNode.SelectSingleNode("notionalReference");
     
     if (notionalReferenceNode != null)
     {
         if (notionalReferenceNode.Attributes["href"] != null || notionalReferenceNode.Attributes["id"] != null) 
         {
             if (notionalReferenceNode.Attributes["id"] != null) 
             {
                 notionalReferenceIDRef_ = notionalReferenceNode.Attributes["id"].Value;
                 NotionalAmountReference ob = new NotionalAmountReference(notionalReferenceNode);
                 IDManager.SetID(notionalReferenceIDRef_, ob);
             }
             else if (notionalReferenceNode.Attributes["href"] != null)
             {
                 notionalReferenceIDRef_ = notionalReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 notionalReference_ = new NotionalAmountReference(notionalReferenceNode);
             }
         }
         else
         {
             notionalReference_ = new NotionalAmountReference(notionalReferenceNode);
         }
     }
     
 
     XmlNode notionalAmountNode = xmlNode.SelectSingleNode("notionalAmount");
     
     if (notionalAmountNode != null)
     {
         if (notionalAmountNode.Attributes["href"] != null || notionalAmountNode.Attributes["id"] != null) 
         {
             if (notionalAmountNode.Attributes["id"] != null) 
             {
                 notionalAmountIDRef_ = notionalAmountNode.Attributes["id"].Value;
                 Money ob = new Money(notionalAmountNode);
                 IDManager.SetID(notionalAmountIDRef_, ob);
             }
             else if (notionalAmountNode.Attributes["href"] != null)
             {
                 notionalAmountIDRef_ = notionalAmountNode.Attributes["href"].Value;
             }
             else
             {
                 notionalAmount_ = new Money(notionalAmountNode);
             }
         }
         else
         {
             notionalAmount_ = new Money(notionalAmountNode);
         }
     }
     
 
     XmlNode optionEntitlementNode = xmlNode.SelectSingleNode("optionEntitlement");
     
     if (optionEntitlementNode != null)
     {
         if (optionEntitlementNode.Attributes["href"] != null || optionEntitlementNode.Attributes["id"] != null) 
         {
             if (optionEntitlementNode.Attributes["id"] != null) 
             {
                 optionEntitlementIDRef_ = optionEntitlementNode.Attributes["id"].Value;
                 PositiveDecimal ob = new PositiveDecimal(optionEntitlementNode);
                 IDManager.SetID(optionEntitlementIDRef_, ob);
             }
             else if (optionEntitlementNode.Attributes["href"] != null)
             {
                 optionEntitlementIDRef_ = optionEntitlementNode.Attributes["href"].Value;
             }
             else
             {
                 optionEntitlement_ = new PositiveDecimal(optionEntitlementNode);
             }
         }
         else
         {
             optionEntitlement_ = new PositiveDecimal(optionEntitlementNode);
         }
     }
     
 
     XmlNode entitlementCurrencyNode = xmlNode.SelectSingleNode("entitlementCurrency");
     
     if (entitlementCurrencyNode != null)
     {
         if (entitlementCurrencyNode.Attributes["href"] != null || entitlementCurrencyNode.Attributes["id"] != null) 
         {
             if (entitlementCurrencyNode.Attributes["id"] != null) 
             {
                 entitlementCurrencyIDRef_ = entitlementCurrencyNode.Attributes["id"].Value;
                 Currency ob = new Currency(entitlementCurrencyNode);
                 IDManager.SetID(entitlementCurrencyIDRef_, ob);
             }
             else if (entitlementCurrencyNode.Attributes["href"] != null)
             {
                 entitlementCurrencyIDRef_ = entitlementCurrencyNode.Attributes["href"].Value;
             }
             else
             {
                 entitlementCurrency_ = new Currency(entitlementCurrencyNode);
             }
         }
         else
         {
             entitlementCurrency_ = new Currency(entitlementCurrencyNode);
         }
     }
     
 
     XmlNode numberOfOptionsNode = xmlNode.SelectSingleNode("numberOfOptions");
     
     if (numberOfOptionsNode != null)
     {
         if (numberOfOptionsNode.Attributes["href"] != null || numberOfOptionsNode.Attributes["id"] != null) 
         {
             if (numberOfOptionsNode.Attributes["id"] != null) 
             {
                 numberOfOptionsIDRef_ = numberOfOptionsNode.Attributes["id"].Value;
                 PositiveDecimal ob = new PositiveDecimal(numberOfOptionsNode);
                 IDManager.SetID(numberOfOptionsIDRef_, ob);
             }
             else if (numberOfOptionsNode.Attributes["href"] != null)
             {
                 numberOfOptionsIDRef_ = numberOfOptionsNode.Attributes["href"].Value;
             }
             else
             {
                 numberOfOptions_ = new PositiveDecimal(numberOfOptionsNode);
             }
         }
         else
         {
             numberOfOptions_ = new PositiveDecimal(numberOfOptionsNode);
         }
     }
     
 
     XmlNode settlementTypeNode = xmlNode.SelectSingleNode("settlementType");
     
     if (settlementTypeNode != null)
     {
         if (settlementTypeNode.Attributes["href"] != null || settlementTypeNode.Attributes["id"] != null) 
         {
             if (settlementTypeNode.Attributes["id"] != null) 
             {
                 settlementTypeIDRef_ = settlementTypeNode.Attributes["id"].Value;
                 SettlementTypeEnum ob = new SettlementTypeEnum(settlementTypeNode);
                 IDManager.SetID(settlementTypeIDRef_, ob);
             }
             else if (settlementTypeNode.Attributes["href"] != null)
             {
                 settlementTypeIDRef_ = settlementTypeNode.Attributes["href"].Value;
             }
             else
             {
                 settlementType_ = new SettlementTypeEnum(settlementTypeNode);
             }
         }
         else
         {
             settlementType_ = new SettlementTypeEnum(settlementTypeNode);
         }
     }
     
 
     XmlNode settlementDateNode = xmlNode.SelectSingleNode("settlementDate");
     
     if (settlementDateNode != null)
     {
         if (settlementDateNode.Attributes["href"] != null || settlementDateNode.Attributes["id"] != null) 
         {
             if (settlementDateNode.Attributes["id"] != null) 
             {
                 settlementDateIDRef_ = settlementDateNode.Attributes["id"].Value;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(settlementDateNode);
                 IDManager.SetID(settlementDateIDRef_, ob);
             }
             else if (settlementDateNode.Attributes["href"] != null)
             {
                 settlementDateIDRef_ = settlementDateNode.Attributes["href"].Value;
             }
             else
             {
                 settlementDate_ = new AdjustableOrRelativeDate(settlementDateNode);
             }
         }
         else
         {
             settlementDate_ = new AdjustableOrRelativeDate(settlementDateNode);
         }
     }
     
 
     XmlNode settlementAmountNode = xmlNode.SelectSingleNode("settlementAmount");
     
     if (settlementAmountNode != null)
     {
         if (settlementAmountNode.Attributes["href"] != null || settlementAmountNode.Attributes["id"] != null) 
         {
             if (settlementAmountNode.Attributes["id"] != null) 
             {
                 settlementAmountIDRef_ = settlementAmountNode.Attributes["id"].Value;
                 Money ob = new Money(settlementAmountNode);
                 IDManager.SetID(settlementAmountIDRef_, ob);
             }
             else if (settlementAmountNode.Attributes["href"] != null)
             {
                 settlementAmountIDRef_ = settlementAmountNode.Attributes["href"].Value;
             }
             else
             {
                 settlementAmount_ = new Money(settlementAmountNode);
             }
         }
         else
         {
             settlementAmount_ = new Money(settlementAmountNode);
         }
     }
     
 
     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;
                 Currency ob = new Currency(settlementCurrencyNode);
                 IDManager.SetID(settlementCurrencyIDRef_, ob);
             }
             else if (settlementCurrencyNode.Attributes["href"] != null)
             {
                 settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
             }
             else
             {
                 settlementCurrency_ = new Currency(settlementCurrencyNode);
             }
         }
         else
         {
             settlementCurrency_ = new Currency(settlementCurrencyNode);
         }
     }
     
 
 }
        public FxDigitalOption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList effectiveDateNodeList = xmlNode.SelectNodes("effectiveDate");

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

            foreach (XmlNode item in effectiveDateNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        effectiveDateIDRef = item.Attributes["id"].Name;
                        AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                        IDManager.SetID(effectiveDateIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        effectiveDateIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        effectiveDate = new AdjustableOrRelativeDate(item);
                    }
                }
            }


            XmlNodeList tenorPeriodNodeList = xmlNode.SelectNodes("tenorPeriod");

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

            foreach (XmlNode item in tenorPeriodNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        tenorPeriodIDRef = item.Attributes["id"].Name;
                        Period ob = Period();
                        IDManager.SetID(tenorPeriodIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        tenorPeriodIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        tenorPeriod = new Period(item);
                    }
                }
            }


            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;
                        FxDigitalAmericanExercise ob = FxDigitalAmericanExercise();
                        IDManager.SetID(americanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        americanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        americanExercise = new FxDigitalAmericanExercise(item);
                    }
                }
            }


            XmlNodeList touchNodeList = xmlNode.SelectNodes("touch");

            foreach (XmlNode item in touchNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        touchIDRef = item.Attributes["id"].Name;
                        List <FxTouch> ob = new List <FxTouch>();
                        ob.Add(new FxTouch(item));
                        IDManager.SetID(touchIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        touchIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        touch.Add(new FxTouch(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;
                        FxEuropeanExercise ob = FxEuropeanExercise();
                        IDManager.SetID(europeanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        europeanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        europeanExercise = new FxEuropeanExercise(item);
                    }
                }
            }


            XmlNodeList triggerNodeList = xmlNode.SelectNodes("trigger");

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


            XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");

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

            foreach (XmlNode item in exerciseProcedureNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef = item.Attributes["id"].Name;
                        ExerciseProcedure ob = ExerciseProcedure();
                        IDManager.SetID(exerciseProcedureIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseProcedureIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exerciseProcedure = new ExerciseProcedure(item);
                    }
                }
            }


            XmlNodeList payoutNodeList = xmlNode.SelectNodes("payout");

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

            foreach (XmlNode item in payoutNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        payoutIDRef = item.Attributes["id"].Name;
                        FxOptionPayout ob = FxOptionPayout();
                        IDManager.SetID(payoutIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        payoutIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        payout = new FxOptionPayout(item);
                    }
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

            foreach (XmlNode item in premiumNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        premiumIDRef = item.Attributes["id"].Name;
                        List <FxOptionPremium> ob = new List <FxOptionPremium>();
                        ob.Add(new FxOptionPremium(item));
                        IDManager.SetID(premiumIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        premiumIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        premium.Add(new FxOptionPremium(item));
                    }
                }
            }
        }
 public FxDigitalOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList effectiveDateNodeList = xmlNode.SelectNodes("effectiveDate");
     if (effectiveDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in effectiveDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 effectiveDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(effectiveDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 effectiveDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 effectiveDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList tenorPeriodNodeList = xmlNode.SelectNodes("tenorPeriod");
     if (tenorPeriodNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in tenorPeriodNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 tenorPeriodIDRef = item.Attributes["id"].Name;
                 Period ob = Period();
                 IDManager.SetID(tenorPeriodIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 tenorPeriodIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 tenorPeriod = new Period(item);
             }
         }
     }
     
 
     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;
                 FxDigitalAmericanExercise ob = FxDigitalAmericanExercise();
                 IDManager.SetID(americanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 americanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 americanExercise = new FxDigitalAmericanExercise(item);
             }
         }
     }
     
 
     XmlNodeList touchNodeList = xmlNode.SelectNodes("touch");
     
     foreach (XmlNode item in touchNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 touchIDRef = item.Attributes["id"].Name;
                 List<FxTouch> ob = new List<FxTouch>();
                 ob.Add(new FxTouch(item));
                 IDManager.SetID(touchIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 touchIDRef = item.Attributes["href"].Name;
             }
             else
             {
             touch.Add(new FxTouch(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;
                 FxEuropeanExercise ob = FxEuropeanExercise();
                 IDManager.SetID(europeanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 europeanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 europeanExercise = new FxEuropeanExercise(item);
             }
         }
     }
     
 
     XmlNodeList triggerNodeList = xmlNode.SelectNodes("trigger");
     
     foreach (XmlNode item in triggerNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 triggerIDRef = item.Attributes["id"].Name;
                 List<FxTrigger> ob = new List<FxTrigger>();
                 ob.Add(new FxTrigger(item));
                 IDManager.SetID(triggerIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 triggerIDRef = item.Attributes["href"].Name;
             }
             else
             {
             trigger.Add(new FxTrigger(item));
             }
         }
     }
     
 
     XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");
     if (exerciseProcedureNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseProcedureNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef = item.Attributes["id"].Name;
                 ExerciseProcedure ob = ExerciseProcedure();
                 IDManager.SetID(exerciseProcedureIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseProcedureIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exerciseProcedure = new ExerciseProcedure(item);
             }
         }
     }
     
 
     XmlNodeList payoutNodeList = xmlNode.SelectNodes("payout");
     if (payoutNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in payoutNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 payoutIDRef = item.Attributes["id"].Name;
                 FxOptionPayout ob = FxOptionPayout();
                 IDManager.SetID(payoutIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 payoutIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 payout = new FxOptionPayout(item);
             }
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     foreach (XmlNode item in premiumNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 premiumIDRef = item.Attributes["id"].Name;
                 List<FxOptionPremium> ob = new List<FxOptionPremium>();
                 ob.Add(new FxOptionPremium(item));
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
             premium.Add(new FxOptionPremium(item));
             }
         }
     }
     
 
 }
        public Swaption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNode buyerPartyReferenceNode = xmlNode.SelectSingleNode("buyerPartyReference");

            if (buyerPartyReferenceNode != null)
            {
                if (buyerPartyReferenceNode.Attributes["href"] != null || buyerPartyReferenceNode.Attributes["id"] != null)
                {
                    if (buyerPartyReferenceNode.Attributes["id"] != null)
                    {
                        buyerPartyReferenceIDRef_ = buyerPartyReferenceNode.Attributes["id"].Value;
                        PartyReference ob = new PartyReference(buyerPartyReferenceNode);
                        IDManager.SetID(buyerPartyReferenceIDRef_, ob);
                    }
                    else if (buyerPartyReferenceNode.Attributes["href"] != null)
                    {
                        buyerPartyReferenceIDRef_ = buyerPartyReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        buyerPartyReference_ = new PartyReference(buyerPartyReferenceNode);
                    }
                }
                else
                {
                    buyerPartyReference_ = new PartyReference(buyerPartyReferenceNode);
                }
            }


            XmlNode buyerAccountReferenceNode = xmlNode.SelectSingleNode("buyerAccountReference");

            if (buyerAccountReferenceNode != null)
            {
                if (buyerAccountReferenceNode.Attributes["href"] != null || buyerAccountReferenceNode.Attributes["id"] != null)
                {
                    if (buyerAccountReferenceNode.Attributes["id"] != null)
                    {
                        buyerAccountReferenceIDRef_ = buyerAccountReferenceNode.Attributes["id"].Value;
                        AccountReference ob = new AccountReference(buyerAccountReferenceNode);
                        IDManager.SetID(buyerAccountReferenceIDRef_, ob);
                    }
                    else if (buyerAccountReferenceNode.Attributes["href"] != null)
                    {
                        buyerAccountReferenceIDRef_ = buyerAccountReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        buyerAccountReference_ = new AccountReference(buyerAccountReferenceNode);
                    }
                }
                else
                {
                    buyerAccountReference_ = new AccountReference(buyerAccountReferenceNode);
                }
            }


            XmlNode sellerPartyReferenceNode = xmlNode.SelectSingleNode("sellerPartyReference");

            if (sellerPartyReferenceNode != null)
            {
                if (sellerPartyReferenceNode.Attributes["href"] != null || sellerPartyReferenceNode.Attributes["id"] != null)
                {
                    if (sellerPartyReferenceNode.Attributes["id"] != null)
                    {
                        sellerPartyReferenceIDRef_ = sellerPartyReferenceNode.Attributes["id"].Value;
                        PartyReference ob = new PartyReference(sellerPartyReferenceNode);
                        IDManager.SetID(sellerPartyReferenceIDRef_, ob);
                    }
                    else if (sellerPartyReferenceNode.Attributes["href"] != null)
                    {
                        sellerPartyReferenceIDRef_ = sellerPartyReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        sellerPartyReference_ = new PartyReference(sellerPartyReferenceNode);
                    }
                }
                else
                {
                    sellerPartyReference_ = new PartyReference(sellerPartyReferenceNode);
                }
            }


            XmlNode sellerAccountReferenceNode = xmlNode.SelectSingleNode("sellerAccountReference");

            if (sellerAccountReferenceNode != null)
            {
                if (sellerAccountReferenceNode.Attributes["href"] != null || sellerAccountReferenceNode.Attributes["id"] != null)
                {
                    if (sellerAccountReferenceNode.Attributes["id"] != null)
                    {
                        sellerAccountReferenceIDRef_ = sellerAccountReferenceNode.Attributes["id"].Value;
                        AccountReference ob = new AccountReference(sellerAccountReferenceNode);
                        IDManager.SetID(sellerAccountReferenceIDRef_, ob);
                    }
                    else if (sellerAccountReferenceNode.Attributes["href"] != null)
                    {
                        sellerAccountReferenceIDRef_ = sellerAccountReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        sellerAccountReference_ = new AccountReference(sellerAccountReferenceNode);
                    }
                }
                else
                {
                    sellerAccountReference_ = new AccountReference(sellerAccountReferenceNode);
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

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


            XmlNode exerciseNode = xmlNode.SelectSingleNode("exercise");

            if (exerciseNode != null)
            {
                if (exerciseNode.Attributes["href"] != null || exerciseNode.Attributes["id"] != null)
                {
                    if (exerciseNode.Attributes["id"] != null)
                    {
                        exerciseIDRef_ = exerciseNode.Attributes["id"].Value;
                        Exercise ob = new Exercise(exerciseNode);
                        IDManager.SetID(exerciseIDRef_, ob);
                    }
                    else if (exerciseNode.Attributes["href"] != null)
                    {
                        exerciseIDRef_ = exerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exercise_ = new Exercise(exerciseNode);
                    }
                }
                else
                {
                    exercise_ = new Exercise(exerciseNode);
                }
            }


            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;
                        AmericanExercise ob = new AmericanExercise(americanExerciseNode);
                        IDManager.SetID(americanExerciseIDRef_, ob);
                    }
                    else if (americanExerciseNode.Attributes["href"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        americanExercise_ = new AmericanExercise(americanExerciseNode);
                    }
                }
                else
                {
                    americanExercise_ = new AmericanExercise(americanExerciseNode);
                }
            }


            XmlNode bermudaExerciseNode = xmlNode.SelectSingleNode("bermudaExercise");

            if (bermudaExerciseNode != null)
            {
                if (bermudaExerciseNode.Attributes["href"] != null || bermudaExerciseNode.Attributes["id"] != null)
                {
                    if (bermudaExerciseNode.Attributes["id"] != null)
                    {
                        bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["id"].Value;
                        BermudaExercise ob = new BermudaExercise(bermudaExerciseNode);
                        IDManager.SetID(bermudaExerciseIDRef_, ob);
                    }
                    else if (bermudaExerciseNode.Attributes["href"] != null)
                    {
                        bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
                    }
                }
                else
                {
                    bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
                }
            }


            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;
                        EuropeanExercise ob = new EuropeanExercise(europeanExerciseNode);
                        IDManager.SetID(europeanExerciseIDRef_, ob);
                    }
                    else if (europeanExerciseNode.Attributes["href"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
                    }
                }
                else
                {
                    europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
                }
            }


            XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");

            if (exerciseProcedureNode != null)
            {
                if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null)
                {
                    if (exerciseProcedureNode.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                        ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                        IDManager.SetID(exerciseProcedureIDRef_, ob);
                    }
                    else if (exerciseProcedureNode.Attributes["href"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                    }
                }
                else
                {
                    exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                }
            }


            XmlNode calculationAgentNode = xmlNode.SelectSingleNode("calculationAgent");

            if (calculationAgentNode != null)
            {
                if (calculationAgentNode.Attributes["href"] != null || calculationAgentNode.Attributes["id"] != null)
                {
                    if (calculationAgentNode.Attributes["id"] != null)
                    {
                        calculationAgentIDRef_ = calculationAgentNode.Attributes["id"].Value;
                        CalculationAgent ob = new CalculationAgent(calculationAgentNode);
                        IDManager.SetID(calculationAgentIDRef_, ob);
                    }
                    else if (calculationAgentNode.Attributes["href"] != null)
                    {
                        calculationAgentIDRef_ = calculationAgentNode.Attributes["href"].Value;
                    }
                    else
                    {
                        calculationAgent_ = new CalculationAgent(calculationAgentNode);
                    }
                }
                else
                {
                    calculationAgent_ = new CalculationAgent(calculationAgentNode);
                }
            }


            XmlNode cashSettlementNode = xmlNode.SelectSingleNode("cashSettlement");

            if (cashSettlementNode != null)
            {
                if (cashSettlementNode.Attributes["href"] != null || cashSettlementNode.Attributes["id"] != null)
                {
                    if (cashSettlementNode.Attributes["id"] != null)
                    {
                        cashSettlementIDRef_ = cashSettlementNode.Attributes["id"].Value;
                        CashSettlement ob = new CashSettlement(cashSettlementNode);
                        IDManager.SetID(cashSettlementIDRef_, ob);
                    }
                    else if (cashSettlementNode.Attributes["href"] != null)
                    {
                        cashSettlementIDRef_ = cashSettlementNode.Attributes["href"].Value;
                    }
                    else
                    {
                        cashSettlement_ = new CashSettlement(cashSettlementNode);
                    }
                }
                else
                {
                    cashSettlement_ = new CashSettlement(cashSettlementNode);
                }
            }


            XmlNode physicalSettlementNode = xmlNode.SelectSingleNode("physicalSettlement");

            if (physicalSettlementNode != null)
            {
                if (physicalSettlementNode.Attributes["href"] != null || physicalSettlementNode.Attributes["id"] != null)
                {
                    if (physicalSettlementNode.Attributes["id"] != null)
                    {
                        physicalSettlementIDRef_ = physicalSettlementNode.Attributes["id"].Value;
                        SwaptionPhysicalSettlement ob = new SwaptionPhysicalSettlement(physicalSettlementNode);
                        IDManager.SetID(physicalSettlementIDRef_, ob);
                    }
                    else if (physicalSettlementNode.Attributes["href"] != null)
                    {
                        physicalSettlementIDRef_ = physicalSettlementNode.Attributes["href"].Value;
                    }
                    else
                    {
                        physicalSettlement_ = new SwaptionPhysicalSettlement(physicalSettlementNode);
                    }
                }
                else
                {
                    physicalSettlement_ = new SwaptionPhysicalSettlement(physicalSettlementNode);
                }
            }


            XmlNode swaptionStraddleNode = xmlNode.SelectSingleNode("swaptionStraddle");

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


            XmlNode swaptionAdjustedDatesNode = xmlNode.SelectSingleNode("swaptionAdjustedDates");

            if (swaptionAdjustedDatesNode != null)
            {
                if (swaptionAdjustedDatesNode.Attributes["href"] != null || swaptionAdjustedDatesNode.Attributes["id"] != null)
                {
                    if (swaptionAdjustedDatesNode.Attributes["id"] != null)
                    {
                        swaptionAdjustedDatesIDRef_ = swaptionAdjustedDatesNode.Attributes["id"].Value;
                        SwaptionAdjustedDates ob = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
                        IDManager.SetID(swaptionAdjustedDatesIDRef_, ob);
                    }
                    else if (swaptionAdjustedDatesNode.Attributes["href"] != null)
                    {
                        swaptionAdjustedDatesIDRef_ = swaptionAdjustedDatesNode.Attributes["href"].Value;
                    }
                    else
                    {
                        swaptionAdjustedDates_ = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
                    }
                }
                else
                {
                    swaptionAdjustedDates_ = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
                }
            }


            XmlNode swapNode = xmlNode.SelectSingleNode("swap");

            if (swapNode != null)
            {
                if (swapNode.Attributes["href"] != null || swapNode.Attributes["id"] != null)
                {
                    if (swapNode.Attributes["id"] != null)
                    {
                        swapIDRef_ = swapNode.Attributes["id"].Value;
                        Swap ob = new Swap(swapNode);
                        IDManager.SetID(swapIDRef_, ob);
                    }
                    else if (swapNode.Attributes["href"] != null)
                    {
                        swapIDRef_ = swapNode.Attributes["href"].Value;
                    }
                    else
                    {
                        swap_ = new Swap(swapNode);
                    }
                }
                else
                {
                    swap_ = new Swap(swapNode);
                }
            }
        }
Esempio n. 5
0
        public OptionBaseExtended(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

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

            foreach (XmlNode item in premiumNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        premiumIDRef = item.Attributes["id"].Name;
                        Premium ob = Premium();
                        IDManager.SetID(premiumIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        premiumIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        premium = new Premium(item);
                    }
                }
            }


            XmlNodeList exerciseNodeList = xmlNode.SelectNodes("exercise");

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

            foreach (XmlNode item in exerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseIDRef = item.Attributes["id"].Name;
                        Exercise ob = Exercise();
                        IDManager.SetID(exerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exercise = new Exercise(item);
                    }
                }
            }


            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;
                        AmericanExercise ob = AmericanExercise();
                        IDManager.SetID(americanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        americanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        americanExercise = new AmericanExercise(item);
                    }
                }
            }


            XmlNodeList bermudaExerciseNodeList = xmlNode.SelectNodes("bermudaExercise");

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

            foreach (XmlNode item in bermudaExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        bermudaExerciseIDRef = item.Attributes["id"].Name;
                        BermudaExercise ob = BermudaExercise();
                        IDManager.SetID(bermudaExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        bermudaExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        bermudaExercise = new BermudaExercise(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;
                        EuropeanExercise ob = EuropeanExercise();
                        IDManager.SetID(europeanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        europeanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        europeanExercise = new EuropeanExercise(item);
                    }
                }
            }


            XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");

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

            foreach (XmlNode item in exerciseProcedureNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef = item.Attributes["id"].Name;
                        ExerciseProcedure ob = ExerciseProcedure();
                        IDManager.SetID(exerciseProcedureIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseProcedureIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exerciseProcedure = new ExerciseProcedure(item);
                    }
                }
            }


            XmlNodeList featureNodeList = xmlNode.SelectNodes("feature");

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

            foreach (XmlNode item in featureNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        featureIDRef = item.Attributes["id"].Name;
                        OptionFeature ob = OptionFeature();
                        IDManager.SetID(featureIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        featureIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        feature = new OptionFeature(item);
                    }
                }
            }


            XmlNodeList notionalReferenceNodeList = xmlNode.SelectNodes("notionalReference");

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

            foreach (XmlNode item in notionalReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        notionalReferenceIDRef = item.Attributes["id"].Name;
                        NotionalAmountReference ob = NotionalAmountReference();
                        IDManager.SetID(notionalReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        notionalReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        notionalReference = new NotionalAmountReference(item);
                    }
                }
            }


            XmlNodeList notionalAmountNodeList = xmlNode.SelectNodes("notionalAmount");

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

            foreach (XmlNode item in notionalAmountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        notionalAmountIDRef = item.Attributes["id"].Name;
                        Money ob = Money();
                        IDManager.SetID(notionalAmountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        notionalAmountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        notionalAmount = new Money(item);
                    }
                }
            }


            XmlNodeList optionEntitlementNodeList = xmlNode.SelectNodes("optionEntitlement");

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

            foreach (XmlNode item in optionEntitlementNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        optionEntitlementIDRef = item.Attributes["id"].Name;
                        PositiveDecimal ob = PositiveDecimal();
                        IDManager.SetID(optionEntitlementIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        optionEntitlementIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        optionEntitlement = new PositiveDecimal(item);
                    }
                }
            }


            XmlNodeList entitlementCurrencyNodeList = xmlNode.SelectNodes("entitlementCurrency");

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

            foreach (XmlNode item in entitlementCurrencyNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        entitlementCurrencyIDRef = item.Attributes["id"].Name;
                        Currency ob = Currency();
                        IDManager.SetID(entitlementCurrencyIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        entitlementCurrencyIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        entitlementCurrency = new Currency(item);
                    }
                }
            }


            XmlNodeList numberOfOptionsNodeList = xmlNode.SelectNodes("numberOfOptions");

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

            foreach (XmlNode item in numberOfOptionsNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        numberOfOptionsIDRef = item.Attributes["id"].Name;
                        PositiveDecimal ob = PositiveDecimal();
                        IDManager.SetID(numberOfOptionsIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        numberOfOptionsIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        numberOfOptions = new PositiveDecimal(item);
                    }
                }
            }


            XmlNodeList settlementTypeNodeList = xmlNode.SelectNodes("settlementType");

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

            foreach (XmlNode item in settlementTypeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementTypeIDRef = item.Attributes["id"].Name;
                        SettlementTypeEnum ob = SettlementTypeEnum();
                        IDManager.SetID(settlementTypeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementTypeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementType = new SettlementTypeEnum(item);
                    }
                }
            }


            XmlNodeList settlementDateNodeList = xmlNode.SelectNodes("settlementDate");

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

            foreach (XmlNode item in settlementDateNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementDateIDRef = item.Attributes["id"].Name;
                        AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                        IDManager.SetID(settlementDateIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementDateIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementDate = new AdjustableOrRelativeDate(item);
                    }
                }
            }


            XmlNodeList settlementAmountNodeList = xmlNode.SelectNodes("settlementAmount");

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

            foreach (XmlNode item in settlementAmountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementAmountIDRef = item.Attributes["id"].Name;
                        Money ob = Money();
                        IDManager.SetID(settlementAmountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementAmountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementAmount = new Money(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;
                        Currency ob = Currency();
                        IDManager.SetID(settlementCurrencyIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementCurrencyIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementCurrency = new Currency(item);
                    }
                }
            }
        }
Esempio n. 6
0
        public OptionBaseExtended(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNode premiumNode = xmlNode.SelectSingleNode("premium");

            if (premiumNode != null)
            {
                if (premiumNode.Attributes["href"] != null || premiumNode.Attributes["id"] != null)
                {
                    if (premiumNode.Attributes["id"] != null)
                    {
                        premiumIDRef_ = premiumNode.Attributes["id"].Value;
                        Premium ob = new Premium(premiumNode);
                        IDManager.SetID(premiumIDRef_, ob);
                    }
                    else if (premiumNode.Attributes["href"] != null)
                    {
                        premiumIDRef_ = premiumNode.Attributes["href"].Value;
                    }
                    else
                    {
                        premium_ = new Premium(premiumNode);
                    }
                }
                else
                {
                    premium_ = new Premium(premiumNode);
                }
            }


            XmlNode exerciseNode = xmlNode.SelectSingleNode("exercise");

            if (exerciseNode != null)
            {
                if (exerciseNode.Attributes["href"] != null || exerciseNode.Attributes["id"] != null)
                {
                    if (exerciseNode.Attributes["id"] != null)
                    {
                        exerciseIDRef_ = exerciseNode.Attributes["id"].Value;
                        Exercise ob = new Exercise(exerciseNode);
                        IDManager.SetID(exerciseIDRef_, ob);
                    }
                    else if (exerciseNode.Attributes["href"] != null)
                    {
                        exerciseIDRef_ = exerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exercise_ = new Exercise(exerciseNode);
                    }
                }
                else
                {
                    exercise_ = new Exercise(exerciseNode);
                }
            }


            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;
                        AmericanExercise ob = new AmericanExercise(americanExerciseNode);
                        IDManager.SetID(americanExerciseIDRef_, ob);
                    }
                    else if (americanExerciseNode.Attributes["href"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        americanExercise_ = new AmericanExercise(americanExerciseNode);
                    }
                }
                else
                {
                    americanExercise_ = new AmericanExercise(americanExerciseNode);
                }
            }


            XmlNode bermudaExerciseNode = xmlNode.SelectSingleNode("bermudaExercise");

            if (bermudaExerciseNode != null)
            {
                if (bermudaExerciseNode.Attributes["href"] != null || bermudaExerciseNode.Attributes["id"] != null)
                {
                    if (bermudaExerciseNode.Attributes["id"] != null)
                    {
                        bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["id"].Value;
                        BermudaExercise ob = new BermudaExercise(bermudaExerciseNode);
                        IDManager.SetID(bermudaExerciseIDRef_, ob);
                    }
                    else if (bermudaExerciseNode.Attributes["href"] != null)
                    {
                        bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
                    }
                }
                else
                {
                    bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
                }
            }


            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;
                        EuropeanExercise ob = new EuropeanExercise(europeanExerciseNode);
                        IDManager.SetID(europeanExerciseIDRef_, ob);
                    }
                    else if (europeanExerciseNode.Attributes["href"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
                    }
                }
                else
                {
                    europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
                }
            }


            XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");

            if (exerciseProcedureNode != null)
            {
                if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null)
                {
                    if (exerciseProcedureNode.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                        ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                        IDManager.SetID(exerciseProcedureIDRef_, ob);
                    }
                    else if (exerciseProcedureNode.Attributes["href"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                    }
                }
                else
                {
                    exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                }
            }


            XmlNode featureNode = xmlNode.SelectSingleNode("feature");

            if (featureNode != null)
            {
                if (featureNode.Attributes["href"] != null || featureNode.Attributes["id"] != null)
                {
                    if (featureNode.Attributes["id"] != null)
                    {
                        featureIDRef_ = featureNode.Attributes["id"].Value;
                        OptionFeature ob = new OptionFeature(featureNode);
                        IDManager.SetID(featureIDRef_, ob);
                    }
                    else if (featureNode.Attributes["href"] != null)
                    {
                        featureIDRef_ = featureNode.Attributes["href"].Value;
                    }
                    else
                    {
                        feature_ = new OptionFeature(featureNode);
                    }
                }
                else
                {
                    feature_ = new OptionFeature(featureNode);
                }
            }


            XmlNode notionalReferenceNode = xmlNode.SelectSingleNode("notionalReference");

            if (notionalReferenceNode != null)
            {
                if (notionalReferenceNode.Attributes["href"] != null || notionalReferenceNode.Attributes["id"] != null)
                {
                    if (notionalReferenceNode.Attributes["id"] != null)
                    {
                        notionalReferenceIDRef_ = notionalReferenceNode.Attributes["id"].Value;
                        NotionalAmountReference ob = new NotionalAmountReference(notionalReferenceNode);
                        IDManager.SetID(notionalReferenceIDRef_, ob);
                    }
                    else if (notionalReferenceNode.Attributes["href"] != null)
                    {
                        notionalReferenceIDRef_ = notionalReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        notionalReference_ = new NotionalAmountReference(notionalReferenceNode);
                    }
                }
                else
                {
                    notionalReference_ = new NotionalAmountReference(notionalReferenceNode);
                }
            }


            XmlNode notionalAmountNode = xmlNode.SelectSingleNode("notionalAmount");

            if (notionalAmountNode != null)
            {
                if (notionalAmountNode.Attributes["href"] != null || notionalAmountNode.Attributes["id"] != null)
                {
                    if (notionalAmountNode.Attributes["id"] != null)
                    {
                        notionalAmountIDRef_ = notionalAmountNode.Attributes["id"].Value;
                        Money ob = new Money(notionalAmountNode);
                        IDManager.SetID(notionalAmountIDRef_, ob);
                    }
                    else if (notionalAmountNode.Attributes["href"] != null)
                    {
                        notionalAmountIDRef_ = notionalAmountNode.Attributes["href"].Value;
                    }
                    else
                    {
                        notionalAmount_ = new Money(notionalAmountNode);
                    }
                }
                else
                {
                    notionalAmount_ = new Money(notionalAmountNode);
                }
            }


            XmlNode optionEntitlementNode = xmlNode.SelectSingleNode("optionEntitlement");

            if (optionEntitlementNode != null)
            {
                if (optionEntitlementNode.Attributes["href"] != null || optionEntitlementNode.Attributes["id"] != null)
                {
                    if (optionEntitlementNode.Attributes["id"] != null)
                    {
                        optionEntitlementIDRef_ = optionEntitlementNode.Attributes["id"].Value;
                        PositiveDecimal ob = new PositiveDecimal(optionEntitlementNode);
                        IDManager.SetID(optionEntitlementIDRef_, ob);
                    }
                    else if (optionEntitlementNode.Attributes["href"] != null)
                    {
                        optionEntitlementIDRef_ = optionEntitlementNode.Attributes["href"].Value;
                    }
                    else
                    {
                        optionEntitlement_ = new PositiveDecimal(optionEntitlementNode);
                    }
                }
                else
                {
                    optionEntitlement_ = new PositiveDecimal(optionEntitlementNode);
                }
            }


            XmlNode entitlementCurrencyNode = xmlNode.SelectSingleNode("entitlementCurrency");

            if (entitlementCurrencyNode != null)
            {
                if (entitlementCurrencyNode.Attributes["href"] != null || entitlementCurrencyNode.Attributes["id"] != null)
                {
                    if (entitlementCurrencyNode.Attributes["id"] != null)
                    {
                        entitlementCurrencyIDRef_ = entitlementCurrencyNode.Attributes["id"].Value;
                        Currency ob = new Currency(entitlementCurrencyNode);
                        IDManager.SetID(entitlementCurrencyIDRef_, ob);
                    }
                    else if (entitlementCurrencyNode.Attributes["href"] != null)
                    {
                        entitlementCurrencyIDRef_ = entitlementCurrencyNode.Attributes["href"].Value;
                    }
                    else
                    {
                        entitlementCurrency_ = new Currency(entitlementCurrencyNode);
                    }
                }
                else
                {
                    entitlementCurrency_ = new Currency(entitlementCurrencyNode);
                }
            }


            XmlNode numberOfOptionsNode = xmlNode.SelectSingleNode("numberOfOptions");

            if (numberOfOptionsNode != null)
            {
                if (numberOfOptionsNode.Attributes["href"] != null || numberOfOptionsNode.Attributes["id"] != null)
                {
                    if (numberOfOptionsNode.Attributes["id"] != null)
                    {
                        numberOfOptionsIDRef_ = numberOfOptionsNode.Attributes["id"].Value;
                        PositiveDecimal ob = new PositiveDecimal(numberOfOptionsNode);
                        IDManager.SetID(numberOfOptionsIDRef_, ob);
                    }
                    else if (numberOfOptionsNode.Attributes["href"] != null)
                    {
                        numberOfOptionsIDRef_ = numberOfOptionsNode.Attributes["href"].Value;
                    }
                    else
                    {
                        numberOfOptions_ = new PositiveDecimal(numberOfOptionsNode);
                    }
                }
                else
                {
                    numberOfOptions_ = new PositiveDecimal(numberOfOptionsNode);
                }
            }


            XmlNode settlementTypeNode = xmlNode.SelectSingleNode("settlementType");

            if (settlementTypeNode != null)
            {
                if (settlementTypeNode.Attributes["href"] != null || settlementTypeNode.Attributes["id"] != null)
                {
                    if (settlementTypeNode.Attributes["id"] != null)
                    {
                        settlementTypeIDRef_ = settlementTypeNode.Attributes["id"].Value;
                        SettlementTypeEnum ob = new SettlementTypeEnum(settlementTypeNode);
                        IDManager.SetID(settlementTypeIDRef_, ob);
                    }
                    else if (settlementTypeNode.Attributes["href"] != null)
                    {
                        settlementTypeIDRef_ = settlementTypeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementType_ = new SettlementTypeEnum(settlementTypeNode);
                    }
                }
                else
                {
                    settlementType_ = new SettlementTypeEnum(settlementTypeNode);
                }
            }


            XmlNode settlementDateNode = xmlNode.SelectSingleNode("settlementDate");

            if (settlementDateNode != null)
            {
                if (settlementDateNode.Attributes["href"] != null || settlementDateNode.Attributes["id"] != null)
                {
                    if (settlementDateNode.Attributes["id"] != null)
                    {
                        settlementDateIDRef_ = settlementDateNode.Attributes["id"].Value;
                        AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(settlementDateNode);
                        IDManager.SetID(settlementDateIDRef_, ob);
                    }
                    else if (settlementDateNode.Attributes["href"] != null)
                    {
                        settlementDateIDRef_ = settlementDateNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementDate_ = new AdjustableOrRelativeDate(settlementDateNode);
                    }
                }
                else
                {
                    settlementDate_ = new AdjustableOrRelativeDate(settlementDateNode);
                }
            }


            XmlNode settlementAmountNode = xmlNode.SelectSingleNode("settlementAmount");

            if (settlementAmountNode != null)
            {
                if (settlementAmountNode.Attributes["href"] != null || settlementAmountNode.Attributes["id"] != null)
                {
                    if (settlementAmountNode.Attributes["id"] != null)
                    {
                        settlementAmountIDRef_ = settlementAmountNode.Attributes["id"].Value;
                        Money ob = new Money(settlementAmountNode);
                        IDManager.SetID(settlementAmountIDRef_, ob);
                    }
                    else if (settlementAmountNode.Attributes["href"] != null)
                    {
                        settlementAmountIDRef_ = settlementAmountNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementAmount_ = new Money(settlementAmountNode);
                    }
                }
                else
                {
                    settlementAmount_ = new Money(settlementAmountNode);
                }
            }


            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;
                        Currency ob = new Currency(settlementCurrencyNode);
                        IDManager.SetID(settlementCurrencyIDRef_, ob);
                    }
                    else if (settlementCurrencyNode.Attributes["href"] != null)
                    {
                        settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementCurrency_ = new Currency(settlementCurrencyNode);
                    }
                }
                else
                {
                    settlementCurrency_ = new Currency(settlementCurrencyNode);
                }
            }
        }
 public FxDigitalOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode effectiveDateNode = xmlNode.SelectSingleNode("effectiveDate");
     
     if (effectiveDateNode != null)
     {
         if (effectiveDateNode.Attributes["href"] != null || effectiveDateNode.Attributes["id"] != null) 
         {
             if (effectiveDateNode.Attributes["id"] != null) 
             {
                 effectiveDateIDRef_ = effectiveDateNode.Attributes["id"].Value;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(effectiveDateNode);
                 IDManager.SetID(effectiveDateIDRef_, ob);
             }
             else if (effectiveDateNode.Attributes["href"] != null)
             {
                 effectiveDateIDRef_ = effectiveDateNode.Attributes["href"].Value;
             }
             else
             {
                 effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
             }
         }
         else
         {
             effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
         }
     }
     
 
     XmlNode tenorPeriodNode = xmlNode.SelectSingleNode("tenorPeriod");
     
     if (tenorPeriodNode != null)
     {
         if (tenorPeriodNode.Attributes["href"] != null || tenorPeriodNode.Attributes["id"] != null) 
         {
             if (tenorPeriodNode.Attributes["id"] != null) 
             {
                 tenorPeriodIDRef_ = tenorPeriodNode.Attributes["id"].Value;
                 Period ob = new Period(tenorPeriodNode);
                 IDManager.SetID(tenorPeriodIDRef_, ob);
             }
             else if (tenorPeriodNode.Attributes["href"] != null)
             {
                 tenorPeriodIDRef_ = tenorPeriodNode.Attributes["href"].Value;
             }
             else
             {
                 tenorPeriod_ = new Period(tenorPeriodNode);
             }
         }
         else
         {
             tenorPeriod_ = new Period(tenorPeriodNode);
         }
     }
     
 
     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;
                 FxDigitalAmericanExercise ob = new FxDigitalAmericanExercise(americanExerciseNode);
                 IDManager.SetID(americanExerciseIDRef_, ob);
             }
             else if (americanExerciseNode.Attributes["href"] != null)
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 americanExercise_ = new FxDigitalAmericanExercise(americanExerciseNode);
             }
         }
         else
         {
             americanExercise_ = new FxDigitalAmericanExercise(americanExerciseNode);
         }
     }
     
 
     XmlNodeList touchNodeList = xmlNode.SelectNodes("touch");
     
     if (touchNodeList != null)
     {
         this.touch_ = new List<FxTouch>();
         foreach (XmlNode item in touchNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     touchIDRef_ = item.Attributes["id"].Value;
                     touch_.Add(new FxTouch(item));
                     IDManager.SetID(touchIDRef_, touch_[touch_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     touchIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 touch_.Add(new FxTouch(item));
                 }
             }
             else
             {
                 touch_.Add(new FxTouch(item));
             }
         }
     }
     
 
     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;
                 FxEuropeanExercise ob = new FxEuropeanExercise(europeanExerciseNode);
                 IDManager.SetID(europeanExerciseIDRef_, ob);
             }
             else if (europeanExerciseNode.Attributes["href"] != null)
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
             }
         }
         else
         {
             europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
         }
     }
     
 
     XmlNodeList triggerNodeList = xmlNode.SelectNodes("trigger");
     
     if (triggerNodeList != null)
     {
         this.trigger_ = new List<FxTrigger>();
         foreach (XmlNode item in triggerNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     triggerIDRef_ = item.Attributes["id"].Value;
                     trigger_.Add(new FxTrigger(item));
                     IDManager.SetID(triggerIDRef_, trigger_[trigger_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     triggerIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 trigger_.Add(new FxTrigger(item));
                 }
             }
             else
             {
                 trigger_.Add(new FxTrigger(item));
             }
         }
     }
     
 
     XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");
     
     if (exerciseProcedureNode != null)
     {
         if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null) 
         {
             if (exerciseProcedureNode.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                 ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                 IDManager.SetID(exerciseProcedureIDRef_, ob);
             }
             else if (exerciseProcedureNode.Attributes["href"] != null)
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
             }
             else
             {
                 exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
             }
         }
         else
         {
             exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
         }
     }
     
 
     XmlNode payoutNode = xmlNode.SelectSingleNode("payout");
     
     if (payoutNode != null)
     {
         if (payoutNode.Attributes["href"] != null || payoutNode.Attributes["id"] != null) 
         {
             if (payoutNode.Attributes["id"] != null) 
             {
                 payoutIDRef_ = payoutNode.Attributes["id"].Value;
                 FxOptionPayout ob = new FxOptionPayout(payoutNode);
                 IDManager.SetID(payoutIDRef_, ob);
             }
             else if (payoutNode.Attributes["href"] != null)
             {
                 payoutIDRef_ = payoutNode.Attributes["href"].Value;
             }
             else
             {
                 payout_ = new FxOptionPayout(payoutNode);
             }
         }
         else
         {
             payout_ = new FxOptionPayout(payoutNode);
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     if (premiumNodeList != null)
     {
         this.premium_ = new List<FxOptionPremium>();
         foreach (XmlNode item in premiumNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     premiumIDRef_ = item.Attributes["id"].Value;
                     premium_.Add(new FxOptionPremium(item));
                     IDManager.SetID(premiumIDRef_, premium_[premium_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     premiumIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 premium_.Add(new FxOptionPremium(item));
                 }
             }
             else
             {
                 premium_.Add(new FxOptionPremium(item));
             }
         }
     }
     
 
 }
Esempio n. 8
0
        public FxDigitalOption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNode effectiveDateNode = xmlNode.SelectSingleNode("effectiveDate");

            if (effectiveDateNode != null)
            {
                if (effectiveDateNode.Attributes["href"] != null || effectiveDateNode.Attributes["id"] != null)
                {
                    if (effectiveDateNode.Attributes["id"] != null)
                    {
                        effectiveDateIDRef_ = effectiveDateNode.Attributes["id"].Value;
                        AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(effectiveDateNode);
                        IDManager.SetID(effectiveDateIDRef_, ob);
                    }
                    else if (effectiveDateNode.Attributes["href"] != null)
                    {
                        effectiveDateIDRef_ = effectiveDateNode.Attributes["href"].Value;
                    }
                    else
                    {
                        effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
                    }
                }
                else
                {
                    effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
                }
            }


            XmlNode tenorPeriodNode = xmlNode.SelectSingleNode("tenorPeriod");

            if (tenorPeriodNode != null)
            {
                if (tenorPeriodNode.Attributes["href"] != null || tenorPeriodNode.Attributes["id"] != null)
                {
                    if (tenorPeriodNode.Attributes["id"] != null)
                    {
                        tenorPeriodIDRef_ = tenorPeriodNode.Attributes["id"].Value;
                        Period ob = new Period(tenorPeriodNode);
                        IDManager.SetID(tenorPeriodIDRef_, ob);
                    }
                    else if (tenorPeriodNode.Attributes["href"] != null)
                    {
                        tenorPeriodIDRef_ = tenorPeriodNode.Attributes["href"].Value;
                    }
                    else
                    {
                        tenorPeriod_ = new Period(tenorPeriodNode);
                    }
                }
                else
                {
                    tenorPeriod_ = new Period(tenorPeriodNode);
                }
            }


            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;
                        FxDigitalAmericanExercise ob = new FxDigitalAmericanExercise(americanExerciseNode);
                        IDManager.SetID(americanExerciseIDRef_, ob);
                    }
                    else if (americanExerciseNode.Attributes["href"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        americanExercise_ = new FxDigitalAmericanExercise(americanExerciseNode);
                    }
                }
                else
                {
                    americanExercise_ = new FxDigitalAmericanExercise(americanExerciseNode);
                }
            }


            XmlNodeList touchNodeList = xmlNode.SelectNodes("touch");

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


            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;
                        FxEuropeanExercise ob = new FxEuropeanExercise(europeanExerciseNode);
                        IDManager.SetID(europeanExerciseIDRef_, ob);
                    }
                    else if (europeanExerciseNode.Attributes["href"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
                    }
                }
                else
                {
                    europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
                }
            }


            XmlNodeList triggerNodeList = xmlNode.SelectNodes("trigger");

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


            XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");

            if (exerciseProcedureNode != null)
            {
                if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null)
                {
                    if (exerciseProcedureNode.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                        ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                        IDManager.SetID(exerciseProcedureIDRef_, ob);
                    }
                    else if (exerciseProcedureNode.Attributes["href"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                    }
                }
                else
                {
                    exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                }
            }


            XmlNode payoutNode = xmlNode.SelectSingleNode("payout");

            if (payoutNode != null)
            {
                if (payoutNode.Attributes["href"] != null || payoutNode.Attributes["id"] != null)
                {
                    if (payoutNode.Attributes["id"] != null)
                    {
                        payoutIDRef_ = payoutNode.Attributes["id"].Value;
                        FxOptionPayout ob = new FxOptionPayout(payoutNode);
                        IDManager.SetID(payoutIDRef_, ob);
                    }
                    else if (payoutNode.Attributes["href"] != null)
                    {
                        payoutIDRef_ = payoutNode.Attributes["href"].Value;
                    }
                    else
                    {
                        payout_ = new FxOptionPayout(payoutNode);
                    }
                }
                else
                {
                    payout_ = new FxOptionPayout(payoutNode);
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

            if (premiumNodeList != null)
            {
                this.premium_ = new List <FxOptionPremium>();
                foreach (XmlNode item in premiumNodeList)
                {
                    if (item.Attributes["href"] != null || item.Attributes["id"] != null)
                    {
                        if (item.Attributes["id"] != null)
                        {
                            premiumIDRef_ = item.Attributes["id"].Value;
                            premium_.Add(new FxOptionPremium(item));
                            IDManager.SetID(premiumIDRef_, premium_[premium_.Count - 1]);
                        }
                        else if (item.Attributes["href"] != null)
                        {
                            premiumIDRef_ = item.Attributes["href"].Value;
                        }
                        else
                        {
                            premium_.Add(new FxOptionPremium(item));
                        }
                    }
                    else
                    {
                        premium_.Add(new FxOptionPremium(item));
                    }
                }
            }
        }
        public FxOption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList effectiveDateNodeList = xmlNode.SelectNodes("effectiveDate");

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

            foreach (XmlNode item in effectiveDateNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        effectiveDateIDRef = item.Attributes["id"].Name;
                        AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                        IDManager.SetID(effectiveDateIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        effectiveDateIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        effectiveDate = new AdjustableOrRelativeDate(item);
                    }
                }
            }


            XmlNodeList tenorPeriodNodeList = xmlNode.SelectNodes("tenorPeriod");

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

            foreach (XmlNode item in tenorPeriodNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        tenorPeriodIDRef = item.Attributes["id"].Name;
                        Period ob = Period();
                        IDManager.SetID(tenorPeriodIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        tenorPeriodIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        tenorPeriod = new Period(item);
                    }
                }
            }


            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;
                        FxAmericanExercise ob = FxAmericanExercise();
                        IDManager.SetID(americanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        americanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        americanExercise = new FxAmericanExercise(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;
                        FxEuropeanExercise ob = FxEuropeanExercise();
                        IDManager.SetID(europeanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        europeanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        europeanExercise = new FxEuropeanExercise(item);
                    }
                }
            }


            XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");

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

            foreach (XmlNode item in exerciseProcedureNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef = item.Attributes["id"].Name;
                        ExerciseProcedure ob = ExerciseProcedure();
                        IDManager.SetID(exerciseProcedureIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseProcedureIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exerciseProcedure = new ExerciseProcedure(item);
                    }
                }
            }


            XmlNodeList putCurrencyAmountNodeList = xmlNode.SelectNodes("putCurrencyAmount");

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

            foreach (XmlNode item in putCurrencyAmountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        putCurrencyAmountIDRef = item.Attributes["id"].Name;
                        NonNegativeMoney ob = NonNegativeMoney();
                        IDManager.SetID(putCurrencyAmountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        putCurrencyAmountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        putCurrencyAmount = new NonNegativeMoney(item);
                    }
                }
            }


            XmlNodeList callCurrencyAmountNodeList = xmlNode.SelectNodes("callCurrencyAmount");

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

            foreach (XmlNode item in callCurrencyAmountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        callCurrencyAmountIDRef = item.Attributes["id"].Name;
                        NonNegativeMoney ob = NonNegativeMoney();
                        IDManager.SetID(callCurrencyAmountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        callCurrencyAmountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        callCurrencyAmount = new NonNegativeMoney(item);
                    }
                }
            }


            XmlNodeList soldAsNodeList = xmlNode.SelectNodes("soldAs");

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

            foreach (XmlNode item in soldAsNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        soldAsIDRef = item.Attributes["id"].Name;
                        PutCallEnum ob = PutCallEnum();
                        IDManager.SetID(soldAsIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        soldAsIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        soldAs = new PutCallEnum(item);
                    }
                }
            }


            XmlNodeList strikeNodeList = xmlNode.SelectNodes("strike");

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

            foreach (XmlNode item in strikeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        strikeIDRef = item.Attributes["id"].Name;
                        FxStrikePrice ob = FxStrikePrice();
                        IDManager.SetID(strikeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        strikeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        strike = new FxStrikePrice(item);
                    }
                }
            }


            XmlNodeList spotRateNodeList = xmlNode.SelectNodes("spotRate");

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

            foreach (XmlNode item in spotRateNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        spotRateIDRef = item.Attributes["id"].Name;
                        PositiveDecimal ob = PositiveDecimal();
                        IDManager.SetID(spotRateIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        spotRateIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        spotRate = new PositiveDecimal(item);
                    }
                }
            }


            XmlNodeList featuresNodeList = xmlNode.SelectNodes("features");

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

            foreach (XmlNode item in featuresNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        featuresIDRef = item.Attributes["id"].Name;
                        FxOptionFeatures ob = FxOptionFeatures();
                        IDManager.SetID(featuresIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        featuresIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        features = new FxOptionFeatures(item);
                    }
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

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


            XmlNodeList cashSettlementNodeList = xmlNode.SelectNodes("cashSettlement");

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

            foreach (XmlNode item in cashSettlementNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        cashSettlementIDRef = item.Attributes["id"].Name;
                        FxCashSettlement ob = FxCashSettlement();
                        IDManager.SetID(cashSettlementIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        cashSettlementIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        cashSettlement = new FxCashSettlement(item);
                    }
                }
            }
        }
 public Swaption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList buyerPartyReferenceNodeList = xmlNode.SelectNodes("buyerPartyReference");
     if (buyerPartyReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in buyerPartyReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 buyerPartyReferenceIDRef = item.Attributes["id"].Name;
                 PartyReference ob = PartyReference();
                 IDManager.SetID(buyerPartyReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 buyerPartyReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 buyerPartyReference = new PartyReference(item);
             }
         }
     }
     
 
     XmlNodeList buyerAccountReferenceNodeList = xmlNode.SelectNodes("buyerAccountReference");
     if (buyerAccountReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in buyerAccountReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 buyerAccountReferenceIDRef = item.Attributes["id"].Name;
                 AccountReference ob = AccountReference();
                 IDManager.SetID(buyerAccountReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 buyerAccountReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 buyerAccountReference = new AccountReference(item);
             }
         }
     }
     
 
     XmlNodeList sellerPartyReferenceNodeList = xmlNode.SelectNodes("sellerPartyReference");
     if (sellerPartyReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in sellerPartyReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 sellerPartyReferenceIDRef = item.Attributes["id"].Name;
                 PartyReference ob = PartyReference();
                 IDManager.SetID(sellerPartyReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 sellerPartyReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 sellerPartyReference = new PartyReference(item);
             }
         }
     }
     
 
     XmlNodeList sellerAccountReferenceNodeList = xmlNode.SelectNodes("sellerAccountReference");
     if (sellerAccountReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in sellerAccountReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 sellerAccountReferenceIDRef = item.Attributes["id"].Name;
                 AccountReference ob = AccountReference();
                 IDManager.SetID(sellerAccountReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 sellerAccountReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 sellerAccountReference = new AccountReference(item);
             }
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     foreach (XmlNode item in premiumNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 premiumIDRef = item.Attributes["id"].Name;
                 List<Payment> ob = new List<Payment>();
                 ob.Add(new Payment(item));
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
             premium.Add(new Payment(item));
             }
         }
     }
     
 
     XmlNodeList exerciseNodeList = xmlNode.SelectNodes("exercise");
     if (exerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseIDRef = item.Attributes["id"].Name;
                 Exercise ob = Exercise();
                 IDManager.SetID(exerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exercise = new Exercise(item);
             }
         }
     }
     
 
     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;
                 AmericanExercise ob = AmericanExercise();
                 IDManager.SetID(americanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 americanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 americanExercise = new AmericanExercise(item);
             }
         }
     }
     
 
     XmlNodeList bermudaExerciseNodeList = xmlNode.SelectNodes("bermudaExercise");
     if (bermudaExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in bermudaExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 bermudaExerciseIDRef = item.Attributes["id"].Name;
                 BermudaExercise ob = BermudaExercise();
                 IDManager.SetID(bermudaExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 bermudaExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 bermudaExercise = new BermudaExercise(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;
                 EuropeanExercise ob = EuropeanExercise();
                 IDManager.SetID(europeanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 europeanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 europeanExercise = new EuropeanExercise(item);
             }
         }
     }
     
 
     XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");
     if (exerciseProcedureNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseProcedureNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef = item.Attributes["id"].Name;
                 ExerciseProcedure ob = ExerciseProcedure();
                 IDManager.SetID(exerciseProcedureIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseProcedureIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exerciseProcedure = new ExerciseProcedure(item);
             }
         }
     }
     
 
     XmlNodeList calculationAgentNodeList = xmlNode.SelectNodes("calculationAgent");
     if (calculationAgentNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationAgentNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationAgentIDRef = item.Attributes["id"].Name;
                 CalculationAgent ob = CalculationAgent();
                 IDManager.SetID(calculationAgentIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationAgentIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationAgent = new CalculationAgent(item);
             }
         }
     }
     
 
     XmlNodeList cashSettlementNodeList = xmlNode.SelectNodes("cashSettlement");
     if (cashSettlementNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in cashSettlementNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 cashSettlementIDRef = item.Attributes["id"].Name;
                 CashSettlement ob = CashSettlement();
                 IDManager.SetID(cashSettlementIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 cashSettlementIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 cashSettlement = new CashSettlement(item);
             }
         }
     }
     
 
     XmlNodeList physicalSettlementNodeList = xmlNode.SelectNodes("physicalSettlement");
     if (physicalSettlementNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in physicalSettlementNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 physicalSettlementIDRef = item.Attributes["id"].Name;
                 SwaptionPhysicalSettlement ob = SwaptionPhysicalSettlement();
                 IDManager.SetID(physicalSettlementIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 physicalSettlementIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 physicalSettlement = new SwaptionPhysicalSettlement(item);
             }
         }
     }
     
 
     XmlNodeList swaptionStraddleNodeList = xmlNode.SelectNodes("swaptionStraddle");
     if (swaptionStraddleNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in swaptionStraddleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 swaptionStraddleIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(swaptionStraddleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 swaptionStraddleIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 swaptionStraddle = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList swaptionAdjustedDatesNodeList = xmlNode.SelectNodes("swaptionAdjustedDates");
     if (swaptionAdjustedDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in swaptionAdjustedDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 swaptionAdjustedDatesIDRef = item.Attributes["id"].Name;
                 SwaptionAdjustedDates ob = SwaptionAdjustedDates();
                 IDManager.SetID(swaptionAdjustedDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 swaptionAdjustedDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 swaptionAdjustedDates = new SwaptionAdjustedDates(item);
             }
         }
     }
     
 
     XmlNodeList swapNodeList = xmlNode.SelectNodes("swap");
     if (swapNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in swapNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 swapIDRef = item.Attributes["id"].Name;
                 Swap ob = Swap();
                 IDManager.SetID(swapIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 swapIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 swap = new Swap(item);
             }
         }
     }
     
 
 }
 public FxOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList effectiveDateNodeList = xmlNode.SelectNodes("effectiveDate");
     if (effectiveDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in effectiveDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 effectiveDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(effectiveDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 effectiveDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 effectiveDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList tenorPeriodNodeList = xmlNode.SelectNodes("tenorPeriod");
     if (tenorPeriodNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in tenorPeriodNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 tenorPeriodIDRef = item.Attributes["id"].Name;
                 Period ob = Period();
                 IDManager.SetID(tenorPeriodIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 tenorPeriodIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 tenorPeriod = new Period(item);
             }
         }
     }
     
 
     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;
                 FxAmericanExercise ob = FxAmericanExercise();
                 IDManager.SetID(americanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 americanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 americanExercise = new FxAmericanExercise(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;
                 FxEuropeanExercise ob = FxEuropeanExercise();
                 IDManager.SetID(europeanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 europeanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 europeanExercise = new FxEuropeanExercise(item);
             }
         }
     }
     
 
     XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");
     if (exerciseProcedureNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseProcedureNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef = item.Attributes["id"].Name;
                 ExerciseProcedure ob = ExerciseProcedure();
                 IDManager.SetID(exerciseProcedureIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseProcedureIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exerciseProcedure = new ExerciseProcedure(item);
             }
         }
     }
     
 
     XmlNodeList putCurrencyAmountNodeList = xmlNode.SelectNodes("putCurrencyAmount");
     if (putCurrencyAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in putCurrencyAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 putCurrencyAmountIDRef = item.Attributes["id"].Name;
                 NonNegativeMoney ob = NonNegativeMoney();
                 IDManager.SetID(putCurrencyAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 putCurrencyAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 putCurrencyAmount = new NonNegativeMoney(item);
             }
         }
     }
     
 
     XmlNodeList callCurrencyAmountNodeList = xmlNode.SelectNodes("callCurrencyAmount");
     if (callCurrencyAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in callCurrencyAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 callCurrencyAmountIDRef = item.Attributes["id"].Name;
                 NonNegativeMoney ob = NonNegativeMoney();
                 IDManager.SetID(callCurrencyAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 callCurrencyAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 callCurrencyAmount = new NonNegativeMoney(item);
             }
         }
     }
     
 
     XmlNodeList soldAsNodeList = xmlNode.SelectNodes("soldAs");
     if (soldAsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in soldAsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 soldAsIDRef = item.Attributes["id"].Name;
                 PutCallEnum ob = PutCallEnum();
                 IDManager.SetID(soldAsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 soldAsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 soldAs = new PutCallEnum(item);
             }
         }
     }
     
 
     XmlNodeList strikeNodeList = xmlNode.SelectNodes("strike");
     if (strikeNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in strikeNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 strikeIDRef = item.Attributes["id"].Name;
                 FxStrikePrice ob = FxStrikePrice();
                 IDManager.SetID(strikeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 strikeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 strike = new FxStrikePrice(item);
             }
         }
     }
     
 
     XmlNodeList spotRateNodeList = xmlNode.SelectNodes("spotRate");
     if (spotRateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in spotRateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spotRateIDRef = item.Attributes["id"].Name;
                 PositiveDecimal ob = PositiveDecimal();
                 IDManager.SetID(spotRateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spotRateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 spotRate = new PositiveDecimal(item);
             }
         }
     }
     
 
     XmlNodeList featuresNodeList = xmlNode.SelectNodes("features");
     if (featuresNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in featuresNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 featuresIDRef = item.Attributes["id"].Name;
                 FxOptionFeatures ob = FxOptionFeatures();
                 IDManager.SetID(featuresIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 featuresIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 features = new FxOptionFeatures(item);
             }
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     foreach (XmlNode item in premiumNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 premiumIDRef = item.Attributes["id"].Name;
                 List<FxOptionPremium> ob = new List<FxOptionPremium>();
                 ob.Add(new FxOptionPremium(item));
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
             premium.Add(new FxOptionPremium(item));
             }
         }
     }
     
 
     XmlNodeList cashSettlementNodeList = xmlNode.SelectNodes("cashSettlement");
     if (cashSettlementNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in cashSettlementNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 cashSettlementIDRef = item.Attributes["id"].Name;
                 FxCashSettlement ob = FxCashSettlement();
                 IDManager.SetID(cashSettlementIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 cashSettlementIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 cashSettlement = new FxCashSettlement(item);
             }
         }
     }
     
 
 }
 public FxOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode effectiveDateNode = xmlNode.SelectSingleNode("effectiveDate");
     
     if (effectiveDateNode != null)
     {
         if (effectiveDateNode.Attributes["href"] != null || effectiveDateNode.Attributes["id"] != null) 
         {
             if (effectiveDateNode.Attributes["id"] != null) 
             {
                 effectiveDateIDRef_ = effectiveDateNode.Attributes["id"].Value;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(effectiveDateNode);
                 IDManager.SetID(effectiveDateIDRef_, ob);
             }
             else if (effectiveDateNode.Attributes["href"] != null)
             {
                 effectiveDateIDRef_ = effectiveDateNode.Attributes["href"].Value;
             }
             else
             {
                 effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
             }
         }
         else
         {
             effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
         }
     }
     
 
     XmlNode tenorPeriodNode = xmlNode.SelectSingleNode("tenorPeriod");
     
     if (tenorPeriodNode != null)
     {
         if (tenorPeriodNode.Attributes["href"] != null || tenorPeriodNode.Attributes["id"] != null) 
         {
             if (tenorPeriodNode.Attributes["id"] != null) 
             {
                 tenorPeriodIDRef_ = tenorPeriodNode.Attributes["id"].Value;
                 Period ob = new Period(tenorPeriodNode);
                 IDManager.SetID(tenorPeriodIDRef_, ob);
             }
             else if (tenorPeriodNode.Attributes["href"] != null)
             {
                 tenorPeriodIDRef_ = tenorPeriodNode.Attributes["href"].Value;
             }
             else
             {
                 tenorPeriod_ = new Period(tenorPeriodNode);
             }
         }
         else
         {
             tenorPeriod_ = new Period(tenorPeriodNode);
         }
     }
     
 
     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;
                 FxAmericanExercise ob = new FxAmericanExercise(americanExerciseNode);
                 IDManager.SetID(americanExerciseIDRef_, ob);
             }
             else if (americanExerciseNode.Attributes["href"] != null)
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 americanExercise_ = new FxAmericanExercise(americanExerciseNode);
             }
         }
         else
         {
             americanExercise_ = new FxAmericanExercise(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;
                 FxEuropeanExercise ob = new FxEuropeanExercise(europeanExerciseNode);
                 IDManager.SetID(europeanExerciseIDRef_, ob);
             }
             else if (europeanExerciseNode.Attributes["href"] != null)
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
             }
         }
         else
         {
             europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
         }
     }
     
 
     XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");
     
     if (exerciseProcedureNode != null)
     {
         if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null) 
         {
             if (exerciseProcedureNode.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                 ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                 IDManager.SetID(exerciseProcedureIDRef_, ob);
             }
             else if (exerciseProcedureNode.Attributes["href"] != null)
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
             }
             else
             {
                 exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
             }
         }
         else
         {
             exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
         }
     }
     
 
     XmlNode putCurrencyAmountNode = xmlNode.SelectSingleNode("putCurrencyAmount");
     
     if (putCurrencyAmountNode != null)
     {
         if (putCurrencyAmountNode.Attributes["href"] != null || putCurrencyAmountNode.Attributes["id"] != null) 
         {
             if (putCurrencyAmountNode.Attributes["id"] != null) 
             {
                 putCurrencyAmountIDRef_ = putCurrencyAmountNode.Attributes["id"].Value;
                 NonNegativeMoney ob = new NonNegativeMoney(putCurrencyAmountNode);
                 IDManager.SetID(putCurrencyAmountIDRef_, ob);
             }
             else if (putCurrencyAmountNode.Attributes["href"] != null)
             {
                 putCurrencyAmountIDRef_ = putCurrencyAmountNode.Attributes["href"].Value;
             }
             else
             {
                 putCurrencyAmount_ = new NonNegativeMoney(putCurrencyAmountNode);
             }
         }
         else
         {
             putCurrencyAmount_ = new NonNegativeMoney(putCurrencyAmountNode);
         }
     }
     
 
     XmlNode callCurrencyAmountNode = xmlNode.SelectSingleNode("callCurrencyAmount");
     
     if (callCurrencyAmountNode != null)
     {
         if (callCurrencyAmountNode.Attributes["href"] != null || callCurrencyAmountNode.Attributes["id"] != null) 
         {
             if (callCurrencyAmountNode.Attributes["id"] != null) 
             {
                 callCurrencyAmountIDRef_ = callCurrencyAmountNode.Attributes["id"].Value;
                 NonNegativeMoney ob = new NonNegativeMoney(callCurrencyAmountNode);
                 IDManager.SetID(callCurrencyAmountIDRef_, ob);
             }
             else if (callCurrencyAmountNode.Attributes["href"] != null)
             {
                 callCurrencyAmountIDRef_ = callCurrencyAmountNode.Attributes["href"].Value;
             }
             else
             {
                 callCurrencyAmount_ = new NonNegativeMoney(callCurrencyAmountNode);
             }
         }
         else
         {
             callCurrencyAmount_ = new NonNegativeMoney(callCurrencyAmountNode);
         }
     }
     
 
     XmlNode soldAsNode = xmlNode.SelectSingleNode("soldAs");
     
     if (soldAsNode != null)
     {
         if (soldAsNode.Attributes["href"] != null || soldAsNode.Attributes["id"] != null) 
         {
             if (soldAsNode.Attributes["id"] != null) 
             {
                 soldAsIDRef_ = soldAsNode.Attributes["id"].Value;
                 PutCallEnum ob = new PutCallEnum(soldAsNode);
                 IDManager.SetID(soldAsIDRef_, ob);
             }
             else if (soldAsNode.Attributes["href"] != null)
             {
                 soldAsIDRef_ = soldAsNode.Attributes["href"].Value;
             }
             else
             {
                 soldAs_ = new PutCallEnum(soldAsNode);
             }
         }
         else
         {
             soldAs_ = new PutCallEnum(soldAsNode);
         }
     }
     
 
     XmlNode strikeNode = xmlNode.SelectSingleNode("strike");
     
     if (strikeNode != null)
     {
         if (strikeNode.Attributes["href"] != null || strikeNode.Attributes["id"] != null) 
         {
             if (strikeNode.Attributes["id"] != null) 
             {
                 strikeIDRef_ = strikeNode.Attributes["id"].Value;
                 FxStrikePrice ob = new FxStrikePrice(strikeNode);
                 IDManager.SetID(strikeIDRef_, ob);
             }
             else if (strikeNode.Attributes["href"] != null)
             {
                 strikeIDRef_ = strikeNode.Attributes["href"].Value;
             }
             else
             {
                 strike_ = new FxStrikePrice(strikeNode);
             }
         }
         else
         {
             strike_ = new FxStrikePrice(strikeNode);
         }
     }
     
 
     XmlNode spotRateNode = xmlNode.SelectSingleNode("spotRate");
     
     if (spotRateNode != null)
     {
         if (spotRateNode.Attributes["href"] != null || spotRateNode.Attributes["id"] != null) 
         {
             if (spotRateNode.Attributes["id"] != null) 
             {
                 spotRateIDRef_ = spotRateNode.Attributes["id"].Value;
                 PositiveDecimal ob = new PositiveDecimal(spotRateNode);
                 IDManager.SetID(spotRateIDRef_, ob);
             }
             else if (spotRateNode.Attributes["href"] != null)
             {
                 spotRateIDRef_ = spotRateNode.Attributes["href"].Value;
             }
             else
             {
                 spotRate_ = new PositiveDecimal(spotRateNode);
             }
         }
         else
         {
             spotRate_ = new PositiveDecimal(spotRateNode);
         }
     }
     
 
     XmlNode featuresNode = xmlNode.SelectSingleNode("features");
     
     if (featuresNode != null)
     {
         if (featuresNode.Attributes["href"] != null || featuresNode.Attributes["id"] != null) 
         {
             if (featuresNode.Attributes["id"] != null) 
             {
                 featuresIDRef_ = featuresNode.Attributes["id"].Value;
                 FxOptionFeatures ob = new FxOptionFeatures(featuresNode);
                 IDManager.SetID(featuresIDRef_, ob);
             }
             else if (featuresNode.Attributes["href"] != null)
             {
                 featuresIDRef_ = featuresNode.Attributes["href"].Value;
             }
             else
             {
                 features_ = new FxOptionFeatures(featuresNode);
             }
         }
         else
         {
             features_ = new FxOptionFeatures(featuresNode);
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     if (premiumNodeList != null)
     {
         this.premium_ = new List<FxOptionPremium>();
         foreach (XmlNode item in premiumNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     premiumIDRef_ = item.Attributes["id"].Value;
                     premium_.Add(new FxOptionPremium(item));
                     IDManager.SetID(premiumIDRef_, premium_[premium_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     premiumIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 premium_.Add(new FxOptionPremium(item));
                 }
             }
             else
             {
                 premium_.Add(new FxOptionPremium(item));
             }
         }
     }
     
 
     XmlNode cashSettlementNode = xmlNode.SelectSingleNode("cashSettlement");
     
     if (cashSettlementNode != null)
     {
         if (cashSettlementNode.Attributes["href"] != null || cashSettlementNode.Attributes["id"] != null) 
         {
             if (cashSettlementNode.Attributes["id"] != null) 
             {
                 cashSettlementIDRef_ = cashSettlementNode.Attributes["id"].Value;
                 FxCashSettlement ob = new FxCashSettlement(cashSettlementNode);
                 IDManager.SetID(cashSettlementIDRef_, ob);
             }
             else if (cashSettlementNode.Attributes["href"] != null)
             {
                 cashSettlementIDRef_ = cashSettlementNode.Attributes["href"].Value;
             }
             else
             {
                 cashSettlement_ = new FxCashSettlement(cashSettlementNode);
             }
         }
         else
         {
             cashSettlement_ = new FxCashSettlement(cashSettlementNode);
         }
     }
     
 
 }
        public Swaption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList buyerPartyReferenceNodeList = xmlNode.SelectNodes("buyerPartyReference");

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

            foreach (XmlNode item in buyerPartyReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        buyerPartyReferenceIDRef = item.Attributes["id"].Name;
                        PartyReference ob = PartyReference();
                        IDManager.SetID(buyerPartyReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        buyerPartyReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        buyerPartyReference = new PartyReference(item);
                    }
                }
            }


            XmlNodeList buyerAccountReferenceNodeList = xmlNode.SelectNodes("buyerAccountReference");

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

            foreach (XmlNode item in buyerAccountReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        buyerAccountReferenceIDRef = item.Attributes["id"].Name;
                        AccountReference ob = AccountReference();
                        IDManager.SetID(buyerAccountReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        buyerAccountReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        buyerAccountReference = new AccountReference(item);
                    }
                }
            }


            XmlNodeList sellerPartyReferenceNodeList = xmlNode.SelectNodes("sellerPartyReference");

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

            foreach (XmlNode item in sellerPartyReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        sellerPartyReferenceIDRef = item.Attributes["id"].Name;
                        PartyReference ob = PartyReference();
                        IDManager.SetID(sellerPartyReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        sellerPartyReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        sellerPartyReference = new PartyReference(item);
                    }
                }
            }


            XmlNodeList sellerAccountReferenceNodeList = xmlNode.SelectNodes("sellerAccountReference");

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

            foreach (XmlNode item in sellerAccountReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        sellerAccountReferenceIDRef = item.Attributes["id"].Name;
                        AccountReference ob = AccountReference();
                        IDManager.SetID(sellerAccountReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        sellerAccountReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        sellerAccountReference = new AccountReference(item);
                    }
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

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


            XmlNodeList exerciseNodeList = xmlNode.SelectNodes("exercise");

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

            foreach (XmlNode item in exerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseIDRef = item.Attributes["id"].Name;
                        Exercise ob = Exercise();
                        IDManager.SetID(exerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exercise = new Exercise(item);
                    }
                }
            }


            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;
                        AmericanExercise ob = AmericanExercise();
                        IDManager.SetID(americanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        americanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        americanExercise = new AmericanExercise(item);
                    }
                }
            }


            XmlNodeList bermudaExerciseNodeList = xmlNode.SelectNodes("bermudaExercise");

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

            foreach (XmlNode item in bermudaExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        bermudaExerciseIDRef = item.Attributes["id"].Name;
                        BermudaExercise ob = BermudaExercise();
                        IDManager.SetID(bermudaExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        bermudaExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        bermudaExercise = new BermudaExercise(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;
                        EuropeanExercise ob = EuropeanExercise();
                        IDManager.SetID(europeanExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        europeanExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        europeanExercise = new EuropeanExercise(item);
                    }
                }
            }


            XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");

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

            foreach (XmlNode item in exerciseProcedureNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef = item.Attributes["id"].Name;
                        ExerciseProcedure ob = ExerciseProcedure();
                        IDManager.SetID(exerciseProcedureIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        exerciseProcedureIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        exerciseProcedure = new ExerciseProcedure(item);
                    }
                }
            }


            XmlNodeList calculationAgentNodeList = xmlNode.SelectNodes("calculationAgent");

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

            foreach (XmlNode item in calculationAgentNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        calculationAgentIDRef = item.Attributes["id"].Name;
                        CalculationAgent ob = CalculationAgent();
                        IDManager.SetID(calculationAgentIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        calculationAgentIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        calculationAgent = new CalculationAgent(item);
                    }
                }
            }


            XmlNodeList cashSettlementNodeList = xmlNode.SelectNodes("cashSettlement");

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

            foreach (XmlNode item in cashSettlementNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        cashSettlementIDRef = item.Attributes["id"].Name;
                        CashSettlement ob = CashSettlement();
                        IDManager.SetID(cashSettlementIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        cashSettlementIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        cashSettlement = new CashSettlement(item);
                    }
                }
            }


            XmlNodeList physicalSettlementNodeList = xmlNode.SelectNodes("physicalSettlement");

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

            foreach (XmlNode item in physicalSettlementNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        physicalSettlementIDRef = item.Attributes["id"].Name;
                        SwaptionPhysicalSettlement ob = SwaptionPhysicalSettlement();
                        IDManager.SetID(physicalSettlementIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        physicalSettlementIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        physicalSettlement = new SwaptionPhysicalSettlement(item);
                    }
                }
            }


            XmlNodeList swaptionStraddleNodeList = xmlNode.SelectNodes("swaptionStraddle");

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

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


            XmlNodeList swaptionAdjustedDatesNodeList = xmlNode.SelectNodes("swaptionAdjustedDates");

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

            foreach (XmlNode item in swaptionAdjustedDatesNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        swaptionAdjustedDatesIDRef = item.Attributes["id"].Name;
                        SwaptionAdjustedDates ob = SwaptionAdjustedDates();
                        IDManager.SetID(swaptionAdjustedDatesIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        swaptionAdjustedDatesIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        swaptionAdjustedDates = new SwaptionAdjustedDates(item);
                    }
                }
            }


            XmlNodeList swapNodeList = xmlNode.SelectNodes("swap");

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

            foreach (XmlNode item in swapNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        swapIDRef = item.Attributes["id"].Name;
                        Swap ob = Swap();
                        IDManager.SetID(swapIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        swapIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        swap = new Swap(item);
                    }
                }
            }
        }
 public OptionBaseExtended(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     if (premiumNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in premiumNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 premiumIDRef = item.Attributes["id"].Name;
                 Premium ob = Premium();
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 premium = new Premium(item);
             }
         }
     }
     
 
     XmlNodeList exerciseNodeList = xmlNode.SelectNodes("exercise");
     if (exerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseIDRef = item.Attributes["id"].Name;
                 Exercise ob = Exercise();
                 IDManager.SetID(exerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exercise = new Exercise(item);
             }
         }
     }
     
 
     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;
                 AmericanExercise ob = AmericanExercise();
                 IDManager.SetID(americanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 americanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 americanExercise = new AmericanExercise(item);
             }
         }
     }
     
 
     XmlNodeList bermudaExerciseNodeList = xmlNode.SelectNodes("bermudaExercise");
     if (bermudaExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in bermudaExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 bermudaExerciseIDRef = item.Attributes["id"].Name;
                 BermudaExercise ob = BermudaExercise();
                 IDManager.SetID(bermudaExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 bermudaExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 bermudaExercise = new BermudaExercise(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;
                 EuropeanExercise ob = EuropeanExercise();
                 IDManager.SetID(europeanExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 europeanExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 europeanExercise = new EuropeanExercise(item);
             }
         }
     }
     
 
     XmlNodeList exerciseProcedureNodeList = xmlNode.SelectNodes("exerciseProcedure");
     if (exerciseProcedureNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in exerciseProcedureNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef = item.Attributes["id"].Name;
                 ExerciseProcedure ob = ExerciseProcedure();
                 IDManager.SetID(exerciseProcedureIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseProcedureIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exerciseProcedure = new ExerciseProcedure(item);
             }
         }
     }
     
 
     XmlNodeList featureNodeList = xmlNode.SelectNodes("feature");
     if (featureNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in featureNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 featureIDRef = item.Attributes["id"].Name;
                 OptionFeature ob = OptionFeature();
                 IDManager.SetID(featureIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 featureIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 feature = new OptionFeature(item);
             }
         }
     }
     
 
     XmlNodeList notionalReferenceNodeList = xmlNode.SelectNodes("notionalReference");
     if (notionalReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in notionalReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 notionalReferenceIDRef = item.Attributes["id"].Name;
                 NotionalAmountReference ob = NotionalAmountReference();
                 IDManager.SetID(notionalReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 notionalReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 notionalReference = new NotionalAmountReference(item);
             }
         }
     }
     
 
     XmlNodeList notionalAmountNodeList = xmlNode.SelectNodes("notionalAmount");
     if (notionalAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in notionalAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 notionalAmountIDRef = item.Attributes["id"].Name;
                 Money ob = Money();
                 IDManager.SetID(notionalAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 notionalAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 notionalAmount = new Money(item);
             }
         }
     }
     
 
     XmlNodeList optionEntitlementNodeList = xmlNode.SelectNodes("optionEntitlement");
     if (optionEntitlementNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in optionEntitlementNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 optionEntitlementIDRef = item.Attributes["id"].Name;
                 PositiveDecimal ob = PositiveDecimal();
                 IDManager.SetID(optionEntitlementIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 optionEntitlementIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 optionEntitlement = new PositiveDecimal(item);
             }
         }
     }
     
 
     XmlNodeList entitlementCurrencyNodeList = xmlNode.SelectNodes("entitlementCurrency");
     if (entitlementCurrencyNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in entitlementCurrencyNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 entitlementCurrencyIDRef = item.Attributes["id"].Name;
                 Currency ob = Currency();
                 IDManager.SetID(entitlementCurrencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 entitlementCurrencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 entitlementCurrency = new Currency(item);
             }
         }
     }
     
 
     XmlNodeList numberOfOptionsNodeList = xmlNode.SelectNodes("numberOfOptions");
     if (numberOfOptionsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in numberOfOptionsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 numberOfOptionsIDRef = item.Attributes["id"].Name;
                 PositiveDecimal ob = PositiveDecimal();
                 IDManager.SetID(numberOfOptionsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 numberOfOptionsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 numberOfOptions = new PositiveDecimal(item);
             }
         }
     }
     
 
     XmlNodeList settlementTypeNodeList = xmlNode.SelectNodes("settlementType");
     if (settlementTypeNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementTypeNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementTypeIDRef = item.Attributes["id"].Name;
                 SettlementTypeEnum ob = SettlementTypeEnum();
                 IDManager.SetID(settlementTypeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementTypeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementType = new SettlementTypeEnum(item);
             }
         }
     }
     
 
     XmlNodeList settlementDateNodeList = xmlNode.SelectNodes("settlementDate");
     if (settlementDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(settlementDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList settlementAmountNodeList = xmlNode.SelectNodes("settlementAmount");
     if (settlementAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementAmountIDRef = item.Attributes["id"].Name;
                 Money ob = Money();
                 IDManager.SetID(settlementAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementAmount = new Money(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;
                 Currency ob = Currency();
                 IDManager.SetID(settlementCurrencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementCurrencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementCurrency = new Currency(item);
             }
         }
     }
     
 
 }
        public FxOption(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNode effectiveDateNode = xmlNode.SelectSingleNode("effectiveDate");

            if (effectiveDateNode != null)
            {
                if (effectiveDateNode.Attributes["href"] != null || effectiveDateNode.Attributes["id"] != null)
                {
                    if (effectiveDateNode.Attributes["id"] != null)
                    {
                        effectiveDateIDRef_ = effectiveDateNode.Attributes["id"].Value;
                        AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(effectiveDateNode);
                        IDManager.SetID(effectiveDateIDRef_, ob);
                    }
                    else if (effectiveDateNode.Attributes["href"] != null)
                    {
                        effectiveDateIDRef_ = effectiveDateNode.Attributes["href"].Value;
                    }
                    else
                    {
                        effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
                    }
                }
                else
                {
                    effectiveDate_ = new AdjustableOrRelativeDate(effectiveDateNode);
                }
            }


            XmlNode tenorPeriodNode = xmlNode.SelectSingleNode("tenorPeriod");

            if (tenorPeriodNode != null)
            {
                if (tenorPeriodNode.Attributes["href"] != null || tenorPeriodNode.Attributes["id"] != null)
                {
                    if (tenorPeriodNode.Attributes["id"] != null)
                    {
                        tenorPeriodIDRef_ = tenorPeriodNode.Attributes["id"].Value;
                        Period ob = new Period(tenorPeriodNode);
                        IDManager.SetID(tenorPeriodIDRef_, ob);
                    }
                    else if (tenorPeriodNode.Attributes["href"] != null)
                    {
                        tenorPeriodIDRef_ = tenorPeriodNode.Attributes["href"].Value;
                    }
                    else
                    {
                        tenorPeriod_ = new Period(tenorPeriodNode);
                    }
                }
                else
                {
                    tenorPeriod_ = new Period(tenorPeriodNode);
                }
            }


            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;
                        FxAmericanExercise ob = new FxAmericanExercise(americanExerciseNode);
                        IDManager.SetID(americanExerciseIDRef_, ob);
                    }
                    else if (americanExerciseNode.Attributes["href"] != null)
                    {
                        americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        americanExercise_ = new FxAmericanExercise(americanExerciseNode);
                    }
                }
                else
                {
                    americanExercise_ = new FxAmericanExercise(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;
                        FxEuropeanExercise ob = new FxEuropeanExercise(europeanExerciseNode);
                        IDManager.SetID(europeanExerciseIDRef_, ob);
                    }
                    else if (europeanExerciseNode.Attributes["href"] != null)
                    {
                        europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
                    }
                }
                else
                {
                    europeanExercise_ = new FxEuropeanExercise(europeanExerciseNode);
                }
            }


            XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");

            if (exerciseProcedureNode != null)
            {
                if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null)
                {
                    if (exerciseProcedureNode.Attributes["id"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                        ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                        IDManager.SetID(exerciseProcedureIDRef_, ob);
                    }
                    else if (exerciseProcedureNode.Attributes["href"] != null)
                    {
                        exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
                    }
                    else
                    {
                        exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                    }
                }
                else
                {
                    exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
                }
            }


            XmlNode putCurrencyAmountNode = xmlNode.SelectSingleNode("putCurrencyAmount");

            if (putCurrencyAmountNode != null)
            {
                if (putCurrencyAmountNode.Attributes["href"] != null || putCurrencyAmountNode.Attributes["id"] != null)
                {
                    if (putCurrencyAmountNode.Attributes["id"] != null)
                    {
                        putCurrencyAmountIDRef_ = putCurrencyAmountNode.Attributes["id"].Value;
                        NonNegativeMoney ob = new NonNegativeMoney(putCurrencyAmountNode);
                        IDManager.SetID(putCurrencyAmountIDRef_, ob);
                    }
                    else if (putCurrencyAmountNode.Attributes["href"] != null)
                    {
                        putCurrencyAmountIDRef_ = putCurrencyAmountNode.Attributes["href"].Value;
                    }
                    else
                    {
                        putCurrencyAmount_ = new NonNegativeMoney(putCurrencyAmountNode);
                    }
                }
                else
                {
                    putCurrencyAmount_ = new NonNegativeMoney(putCurrencyAmountNode);
                }
            }


            XmlNode callCurrencyAmountNode = xmlNode.SelectSingleNode("callCurrencyAmount");

            if (callCurrencyAmountNode != null)
            {
                if (callCurrencyAmountNode.Attributes["href"] != null || callCurrencyAmountNode.Attributes["id"] != null)
                {
                    if (callCurrencyAmountNode.Attributes["id"] != null)
                    {
                        callCurrencyAmountIDRef_ = callCurrencyAmountNode.Attributes["id"].Value;
                        NonNegativeMoney ob = new NonNegativeMoney(callCurrencyAmountNode);
                        IDManager.SetID(callCurrencyAmountIDRef_, ob);
                    }
                    else if (callCurrencyAmountNode.Attributes["href"] != null)
                    {
                        callCurrencyAmountIDRef_ = callCurrencyAmountNode.Attributes["href"].Value;
                    }
                    else
                    {
                        callCurrencyAmount_ = new NonNegativeMoney(callCurrencyAmountNode);
                    }
                }
                else
                {
                    callCurrencyAmount_ = new NonNegativeMoney(callCurrencyAmountNode);
                }
            }


            XmlNode soldAsNode = xmlNode.SelectSingleNode("soldAs");

            if (soldAsNode != null)
            {
                if (soldAsNode.Attributes["href"] != null || soldAsNode.Attributes["id"] != null)
                {
                    if (soldAsNode.Attributes["id"] != null)
                    {
                        soldAsIDRef_ = soldAsNode.Attributes["id"].Value;
                        PutCallEnum ob = new PutCallEnum(soldAsNode);
                        IDManager.SetID(soldAsIDRef_, ob);
                    }
                    else if (soldAsNode.Attributes["href"] != null)
                    {
                        soldAsIDRef_ = soldAsNode.Attributes["href"].Value;
                    }
                    else
                    {
                        soldAs_ = new PutCallEnum(soldAsNode);
                    }
                }
                else
                {
                    soldAs_ = new PutCallEnum(soldAsNode);
                }
            }


            XmlNode strikeNode = xmlNode.SelectSingleNode("strike");

            if (strikeNode != null)
            {
                if (strikeNode.Attributes["href"] != null || strikeNode.Attributes["id"] != null)
                {
                    if (strikeNode.Attributes["id"] != null)
                    {
                        strikeIDRef_ = strikeNode.Attributes["id"].Value;
                        FxStrikePrice ob = new FxStrikePrice(strikeNode);
                        IDManager.SetID(strikeIDRef_, ob);
                    }
                    else if (strikeNode.Attributes["href"] != null)
                    {
                        strikeIDRef_ = strikeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        strike_ = new FxStrikePrice(strikeNode);
                    }
                }
                else
                {
                    strike_ = new FxStrikePrice(strikeNode);
                }
            }


            XmlNode spotRateNode = xmlNode.SelectSingleNode("spotRate");

            if (spotRateNode != null)
            {
                if (spotRateNode.Attributes["href"] != null || spotRateNode.Attributes["id"] != null)
                {
                    if (spotRateNode.Attributes["id"] != null)
                    {
                        spotRateIDRef_ = spotRateNode.Attributes["id"].Value;
                        PositiveDecimal ob = new PositiveDecimal(spotRateNode);
                        IDManager.SetID(spotRateIDRef_, ob);
                    }
                    else if (spotRateNode.Attributes["href"] != null)
                    {
                        spotRateIDRef_ = spotRateNode.Attributes["href"].Value;
                    }
                    else
                    {
                        spotRate_ = new PositiveDecimal(spotRateNode);
                    }
                }
                else
                {
                    spotRate_ = new PositiveDecimal(spotRateNode);
                }
            }


            XmlNode featuresNode = xmlNode.SelectSingleNode("features");

            if (featuresNode != null)
            {
                if (featuresNode.Attributes["href"] != null || featuresNode.Attributes["id"] != null)
                {
                    if (featuresNode.Attributes["id"] != null)
                    {
                        featuresIDRef_ = featuresNode.Attributes["id"].Value;
                        FxOptionFeatures ob = new FxOptionFeatures(featuresNode);
                        IDManager.SetID(featuresIDRef_, ob);
                    }
                    else if (featuresNode.Attributes["href"] != null)
                    {
                        featuresIDRef_ = featuresNode.Attributes["href"].Value;
                    }
                    else
                    {
                        features_ = new FxOptionFeatures(featuresNode);
                    }
                }
                else
                {
                    features_ = new FxOptionFeatures(featuresNode);
                }
            }


            XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");

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


            XmlNode cashSettlementNode = xmlNode.SelectSingleNode("cashSettlement");

            if (cashSettlementNode != null)
            {
                if (cashSettlementNode.Attributes["href"] != null || cashSettlementNode.Attributes["id"] != null)
                {
                    if (cashSettlementNode.Attributes["id"] != null)
                    {
                        cashSettlementIDRef_ = cashSettlementNode.Attributes["id"].Value;
                        FxCashSettlement ob = new FxCashSettlement(cashSettlementNode);
                        IDManager.SetID(cashSettlementIDRef_, ob);
                    }
                    else if (cashSettlementNode.Attributes["href"] != null)
                    {
                        cashSettlementIDRef_ = cashSettlementNode.Attributes["href"].Value;
                    }
                    else
                    {
                        cashSettlement_ = new FxCashSettlement(cashSettlementNode);
                    }
                }
                else
                {
                    cashSettlement_ = new FxCashSettlement(cashSettlementNode);
                }
            }
        }
 public Swaption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode buyerPartyReferenceNode = xmlNode.SelectSingleNode("buyerPartyReference");
     
     if (buyerPartyReferenceNode != null)
     {
         if (buyerPartyReferenceNode.Attributes["href"] != null || buyerPartyReferenceNode.Attributes["id"] != null) 
         {
             if (buyerPartyReferenceNode.Attributes["id"] != null) 
             {
                 buyerPartyReferenceIDRef_ = buyerPartyReferenceNode.Attributes["id"].Value;
                 PartyReference ob = new PartyReference(buyerPartyReferenceNode);
                 IDManager.SetID(buyerPartyReferenceIDRef_, ob);
             }
             else if (buyerPartyReferenceNode.Attributes["href"] != null)
             {
                 buyerPartyReferenceIDRef_ = buyerPartyReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 buyerPartyReference_ = new PartyReference(buyerPartyReferenceNode);
             }
         }
         else
         {
             buyerPartyReference_ = new PartyReference(buyerPartyReferenceNode);
         }
     }
     
 
     XmlNode buyerAccountReferenceNode = xmlNode.SelectSingleNode("buyerAccountReference");
     
     if (buyerAccountReferenceNode != null)
     {
         if (buyerAccountReferenceNode.Attributes["href"] != null || buyerAccountReferenceNode.Attributes["id"] != null) 
         {
             if (buyerAccountReferenceNode.Attributes["id"] != null) 
             {
                 buyerAccountReferenceIDRef_ = buyerAccountReferenceNode.Attributes["id"].Value;
                 AccountReference ob = new AccountReference(buyerAccountReferenceNode);
                 IDManager.SetID(buyerAccountReferenceIDRef_, ob);
             }
             else if (buyerAccountReferenceNode.Attributes["href"] != null)
             {
                 buyerAccountReferenceIDRef_ = buyerAccountReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 buyerAccountReference_ = new AccountReference(buyerAccountReferenceNode);
             }
         }
         else
         {
             buyerAccountReference_ = new AccountReference(buyerAccountReferenceNode);
         }
     }
     
 
     XmlNode sellerPartyReferenceNode = xmlNode.SelectSingleNode("sellerPartyReference");
     
     if (sellerPartyReferenceNode != null)
     {
         if (sellerPartyReferenceNode.Attributes["href"] != null || sellerPartyReferenceNode.Attributes["id"] != null) 
         {
             if (sellerPartyReferenceNode.Attributes["id"] != null) 
             {
                 sellerPartyReferenceIDRef_ = sellerPartyReferenceNode.Attributes["id"].Value;
                 PartyReference ob = new PartyReference(sellerPartyReferenceNode);
                 IDManager.SetID(sellerPartyReferenceIDRef_, ob);
             }
             else if (sellerPartyReferenceNode.Attributes["href"] != null)
             {
                 sellerPartyReferenceIDRef_ = sellerPartyReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 sellerPartyReference_ = new PartyReference(sellerPartyReferenceNode);
             }
         }
         else
         {
             sellerPartyReference_ = new PartyReference(sellerPartyReferenceNode);
         }
     }
     
 
     XmlNode sellerAccountReferenceNode = xmlNode.SelectSingleNode("sellerAccountReference");
     
     if (sellerAccountReferenceNode != null)
     {
         if (sellerAccountReferenceNode.Attributes["href"] != null || sellerAccountReferenceNode.Attributes["id"] != null) 
         {
             if (sellerAccountReferenceNode.Attributes["id"] != null) 
             {
                 sellerAccountReferenceIDRef_ = sellerAccountReferenceNode.Attributes["id"].Value;
                 AccountReference ob = new AccountReference(sellerAccountReferenceNode);
                 IDManager.SetID(sellerAccountReferenceIDRef_, ob);
             }
             else if (sellerAccountReferenceNode.Attributes["href"] != null)
             {
                 sellerAccountReferenceIDRef_ = sellerAccountReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 sellerAccountReference_ = new AccountReference(sellerAccountReferenceNode);
             }
         }
         else
         {
             sellerAccountReference_ = new AccountReference(sellerAccountReferenceNode);
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     if (premiumNodeList != null)
     {
         this.premium_ = new List<Payment>();
         foreach (XmlNode item in premiumNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     premiumIDRef_ = item.Attributes["id"].Value;
                     premium_.Add(new Payment(item));
                     IDManager.SetID(premiumIDRef_, premium_[premium_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     premiumIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 premium_.Add(new Payment(item));
                 }
             }
             else
             {
                 premium_.Add(new Payment(item));
             }
         }
     }
     
 
     XmlNode exerciseNode = xmlNode.SelectSingleNode("exercise");
     
     if (exerciseNode != null)
     {
         if (exerciseNode.Attributes["href"] != null || exerciseNode.Attributes["id"] != null) 
         {
             if (exerciseNode.Attributes["id"] != null) 
             {
                 exerciseIDRef_ = exerciseNode.Attributes["id"].Value;
                 Exercise ob = new Exercise(exerciseNode);
                 IDManager.SetID(exerciseIDRef_, ob);
             }
             else if (exerciseNode.Attributes["href"] != null)
             {
                 exerciseIDRef_ = exerciseNode.Attributes["href"].Value;
             }
             else
             {
                 exercise_ = new Exercise(exerciseNode);
             }
         }
         else
         {
             exercise_ = new Exercise(exerciseNode);
         }
     }
     
 
     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;
                 AmericanExercise ob = new AmericanExercise(americanExerciseNode);
                 IDManager.SetID(americanExerciseIDRef_, ob);
             }
             else if (americanExerciseNode.Attributes["href"] != null)
             {
                 americanExerciseIDRef_ = americanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 americanExercise_ = new AmericanExercise(americanExerciseNode);
             }
         }
         else
         {
             americanExercise_ = new AmericanExercise(americanExerciseNode);
         }
     }
     
 
     XmlNode bermudaExerciseNode = xmlNode.SelectSingleNode("bermudaExercise");
     
     if (bermudaExerciseNode != null)
     {
         if (bermudaExerciseNode.Attributes["href"] != null || bermudaExerciseNode.Attributes["id"] != null) 
         {
             if (bermudaExerciseNode.Attributes["id"] != null) 
             {
                 bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["id"].Value;
                 BermudaExercise ob = new BermudaExercise(bermudaExerciseNode);
                 IDManager.SetID(bermudaExerciseIDRef_, ob);
             }
             else if (bermudaExerciseNode.Attributes["href"] != null)
             {
                 bermudaExerciseIDRef_ = bermudaExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
             }
         }
         else
         {
             bermudaExercise_ = new BermudaExercise(bermudaExerciseNode);
         }
     }
     
 
     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;
                 EuropeanExercise ob = new EuropeanExercise(europeanExerciseNode);
                 IDManager.SetID(europeanExerciseIDRef_, ob);
             }
             else if (europeanExerciseNode.Attributes["href"] != null)
             {
                 europeanExerciseIDRef_ = europeanExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
             }
         }
         else
         {
             europeanExercise_ = new EuropeanExercise(europeanExerciseNode);
         }
     }
     
 
     XmlNode exerciseProcedureNode = xmlNode.SelectSingleNode("exerciseProcedure");
     
     if (exerciseProcedureNode != null)
     {
         if (exerciseProcedureNode.Attributes["href"] != null || exerciseProcedureNode.Attributes["id"] != null) 
         {
             if (exerciseProcedureNode.Attributes["id"] != null) 
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["id"].Value;
                 ExerciseProcedure ob = new ExerciseProcedure(exerciseProcedureNode);
                 IDManager.SetID(exerciseProcedureIDRef_, ob);
             }
             else if (exerciseProcedureNode.Attributes["href"] != null)
             {
                 exerciseProcedureIDRef_ = exerciseProcedureNode.Attributes["href"].Value;
             }
             else
             {
                 exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
             }
         }
         else
         {
             exerciseProcedure_ = new ExerciseProcedure(exerciseProcedureNode);
         }
     }
     
 
     XmlNode calculationAgentNode = xmlNode.SelectSingleNode("calculationAgent");
     
     if (calculationAgentNode != null)
     {
         if (calculationAgentNode.Attributes["href"] != null || calculationAgentNode.Attributes["id"] != null) 
         {
             if (calculationAgentNode.Attributes["id"] != null) 
             {
                 calculationAgentIDRef_ = calculationAgentNode.Attributes["id"].Value;
                 CalculationAgent ob = new CalculationAgent(calculationAgentNode);
                 IDManager.SetID(calculationAgentIDRef_, ob);
             }
             else if (calculationAgentNode.Attributes["href"] != null)
             {
                 calculationAgentIDRef_ = calculationAgentNode.Attributes["href"].Value;
             }
             else
             {
                 calculationAgent_ = new CalculationAgent(calculationAgentNode);
             }
         }
         else
         {
             calculationAgent_ = new CalculationAgent(calculationAgentNode);
         }
     }
     
 
     XmlNode cashSettlementNode = xmlNode.SelectSingleNode("cashSettlement");
     
     if (cashSettlementNode != null)
     {
         if (cashSettlementNode.Attributes["href"] != null || cashSettlementNode.Attributes["id"] != null) 
         {
             if (cashSettlementNode.Attributes["id"] != null) 
             {
                 cashSettlementIDRef_ = cashSettlementNode.Attributes["id"].Value;
                 CashSettlement ob = new CashSettlement(cashSettlementNode);
                 IDManager.SetID(cashSettlementIDRef_, ob);
             }
             else if (cashSettlementNode.Attributes["href"] != null)
             {
                 cashSettlementIDRef_ = cashSettlementNode.Attributes["href"].Value;
             }
             else
             {
                 cashSettlement_ = new CashSettlement(cashSettlementNode);
             }
         }
         else
         {
             cashSettlement_ = new CashSettlement(cashSettlementNode);
         }
     }
     
 
     XmlNode physicalSettlementNode = xmlNode.SelectSingleNode("physicalSettlement");
     
     if (physicalSettlementNode != null)
     {
         if (physicalSettlementNode.Attributes["href"] != null || physicalSettlementNode.Attributes["id"] != null) 
         {
             if (physicalSettlementNode.Attributes["id"] != null) 
             {
                 physicalSettlementIDRef_ = physicalSettlementNode.Attributes["id"].Value;
                 SwaptionPhysicalSettlement ob = new SwaptionPhysicalSettlement(physicalSettlementNode);
                 IDManager.SetID(physicalSettlementIDRef_, ob);
             }
             else if (physicalSettlementNode.Attributes["href"] != null)
             {
                 physicalSettlementIDRef_ = physicalSettlementNode.Attributes["href"].Value;
             }
             else
             {
                 physicalSettlement_ = new SwaptionPhysicalSettlement(physicalSettlementNode);
             }
         }
         else
         {
             physicalSettlement_ = new SwaptionPhysicalSettlement(physicalSettlementNode);
         }
     }
     
 
     XmlNode swaptionStraddleNode = xmlNode.SelectSingleNode("swaptionStraddle");
     
     if (swaptionStraddleNode != null)
     {
         if (swaptionStraddleNode.Attributes["href"] != null || swaptionStraddleNode.Attributes["id"] != null) 
         {
             if (swaptionStraddleNode.Attributes["id"] != null) 
             {
                 swaptionStraddleIDRef_ = swaptionStraddleNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(swaptionStraddleNode);
                 IDManager.SetID(swaptionStraddleIDRef_, ob);
             }
             else if (swaptionStraddleNode.Attributes["href"] != null)
             {
                 swaptionStraddleIDRef_ = swaptionStraddleNode.Attributes["href"].Value;
             }
             else
             {
                 swaptionStraddle_ = new XsdTypeBoolean(swaptionStraddleNode);
             }
         }
         else
         {
             swaptionStraddle_ = new XsdTypeBoolean(swaptionStraddleNode);
         }
     }
     
 
     XmlNode swaptionAdjustedDatesNode = xmlNode.SelectSingleNode("swaptionAdjustedDates");
     
     if (swaptionAdjustedDatesNode != null)
     {
         if (swaptionAdjustedDatesNode.Attributes["href"] != null || swaptionAdjustedDatesNode.Attributes["id"] != null) 
         {
             if (swaptionAdjustedDatesNode.Attributes["id"] != null) 
             {
                 swaptionAdjustedDatesIDRef_ = swaptionAdjustedDatesNode.Attributes["id"].Value;
                 SwaptionAdjustedDates ob = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
                 IDManager.SetID(swaptionAdjustedDatesIDRef_, ob);
             }
             else if (swaptionAdjustedDatesNode.Attributes["href"] != null)
             {
                 swaptionAdjustedDatesIDRef_ = swaptionAdjustedDatesNode.Attributes["href"].Value;
             }
             else
             {
                 swaptionAdjustedDates_ = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
             }
         }
         else
         {
             swaptionAdjustedDates_ = new SwaptionAdjustedDates(swaptionAdjustedDatesNode);
         }
     }
     
 
     XmlNode swapNode = xmlNode.SelectSingleNode("swap");
     
     if (swapNode != null)
     {
         if (swapNode.Attributes["href"] != null || swapNode.Attributes["id"] != null) 
         {
             if (swapNode.Attributes["id"] != null) 
             {
                 swapIDRef_ = swapNode.Attributes["id"].Value;
                 Swap ob = new Swap(swapNode);
                 IDManager.SetID(swapIDRef_, ob);
             }
             else if (swapNode.Attributes["href"] != null)
             {
                 swapIDRef_ = swapNode.Attributes["href"].Value;
             }
             else
             {
                 swap_ = new Swap(swapNode);
             }
         }
         else
         {
             swap_ = new Swap(swapNode);
         }
     }
     
 
 }