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); } } }
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 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 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); } } }