public GenericProduct(XmlNode xmlNode) : base(xmlNode) { XmlNode multiLegNode = xmlNode.SelectSingleNode("multiLeg"); if (multiLegNode != null) { if (multiLegNode.Attributes["href"] != null || multiLegNode.Attributes["id"] != null) { if (multiLegNode.Attributes["id"] != null) { multiLegIDRef_ = multiLegNode.Attributes["id"].Value; XsdTypeBoolean ob = new XsdTypeBoolean(multiLegNode); IDManager.SetID(multiLegIDRef_, ob); } else if (multiLegNode.Attributes["href"] != null) { multiLegIDRef_ = multiLegNode.Attributes["href"].Value; } else { multiLeg_ = new XsdTypeBoolean(multiLegNode); } } else { multiLeg_ = new XsdTypeBoolean(multiLegNode); } } 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 counterpartyReferenceNodeList = xmlNode.SelectNodes("counterpartyReference"); if (counterpartyReferenceNodeList != null) { this.counterpartyReference_ = new List<PartyReference>(); foreach (XmlNode item in counterpartyReferenceNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] != null) { if (item.Attributes["id"] != null) { counterpartyReferenceIDRef_ = item.Attributes["id"].Value; counterpartyReference_.Add(new PartyReference(item)); IDManager.SetID(counterpartyReferenceIDRef_, counterpartyReference_[counterpartyReference_.Count - 1 ]); } else if (item.Attributes["href"] != null) { counterpartyReferenceIDRef_ = item.Attributes["href"].Value; } else { counterpartyReference_.Add(new PartyReference(item)); } } else { counterpartyReference_.Add(new PartyReference(item)); } } } 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; SimplePayment ob = new SimplePayment(premiumNode); IDManager.SetID(premiumIDRef_, ob); } else if (premiumNode.Attributes["href"] != null) { premiumIDRef_ = premiumNode.Attributes["href"].Value; } else { premium_ = new SimplePayment(premiumNode); } } else { premium_ = new SimplePayment(premiumNode); } } 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; AdjustableDate2 ob = new AdjustableDate2(effectiveDateNode); IDManager.SetID(effectiveDateIDRef_, ob); } else if (effectiveDateNode.Attributes["href"] != null) { effectiveDateIDRef_ = effectiveDateNode.Attributes["href"].Value; } else { effectiveDate_ = new AdjustableDate2(effectiveDateNode); } } else { effectiveDate_ = new AdjustableDate2(effectiveDateNode); } } XmlNode expirationDateNode = xmlNode.SelectSingleNode("expirationDate"); if (expirationDateNode != null) { if (expirationDateNode.Attributes["href"] != null || expirationDateNode.Attributes["id"] != null) { if (expirationDateNode.Attributes["id"] != null) { expirationDateIDRef_ = expirationDateNode.Attributes["id"].Value; AdjustableDate2 ob = new AdjustableDate2(expirationDateNode); IDManager.SetID(expirationDateIDRef_, ob); } else if (expirationDateNode.Attributes["href"] != null) { expirationDateIDRef_ = expirationDateNode.Attributes["href"].Value; } else { expirationDate_ = new AdjustableDate2(expirationDateNode); } } else { expirationDate_ = new AdjustableDate2(expirationDateNode); } } XmlNode terminationDateNode = xmlNode.SelectSingleNode("terminationDate"); if (terminationDateNode != null) { if (terminationDateNode.Attributes["href"] != null || terminationDateNode.Attributes["id"] != null) { if (terminationDateNode.Attributes["id"] != null) { terminationDateIDRef_ = terminationDateNode.Attributes["id"].Value; AdjustableDate2 ob = new AdjustableDate2(terminationDateNode); IDManager.SetID(terminationDateIDRef_, ob); } else if (terminationDateNode.Attributes["href"] != null) { terminationDateIDRef_ = terminationDateNode.Attributes["href"].Value; } else { terminationDate_ = new AdjustableDate2(terminationDateNode); } } else { terminationDate_ = new AdjustableDate2(terminationDateNode); } } XmlNodeList underlyerNodeList = xmlNode.SelectNodes("underlyer"); if (underlyerNodeList != null) { this.underlyer_ = new List<TradeUnderlyer2>(); foreach (XmlNode item in underlyerNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] != null) { if (item.Attributes["id"] != null) { underlyerIDRef_ = item.Attributes["id"].Value; underlyer_.Add(new TradeUnderlyer2(item)); IDManager.SetID(underlyerIDRef_, underlyer_[underlyer_.Count - 1 ]); } else if (item.Attributes["href"] != null) { underlyerIDRef_ = item.Attributes["href"].Value; } else { underlyer_.Add(new TradeUnderlyer2(item)); } } else { underlyer_.Add(new TradeUnderlyer2(item)); } } } XmlNodeList notionalNodeList = xmlNode.SelectNodes("notional"); if (notionalNodeList != null) { this.notional_ = new List<CashflowNotional>(); foreach (XmlNode item in notionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] != null) { if (item.Attributes["id"] != null) { notionalIDRef_ = item.Attributes["id"].Value; notional_.Add(new CashflowNotional(item)); IDManager.SetID(notionalIDRef_, notional_[notional_.Count - 1 ]); } else if (item.Attributes["href"] != null) { notionalIDRef_ = item.Attributes["href"].Value; } else { notional_.Add(new CashflowNotional(item)); } } else { notional_.Add(new CashflowNotional(item)); } } } XmlNode optionTypeNode = xmlNode.SelectSingleNode("optionType"); if (optionTypeNode != null) { if (optionTypeNode.Attributes["href"] != null || optionTypeNode.Attributes["id"] != null) { if (optionTypeNode.Attributes["id"] != null) { optionTypeIDRef_ = optionTypeNode.Attributes["id"].Value; OptionType ob = new OptionType(optionTypeNode); IDManager.SetID(optionTypeIDRef_, ob); } else if (optionTypeNode.Attributes["href"] != null) { optionTypeIDRef_ = optionTypeNode.Attributes["href"].Value; } else { optionType_ = new OptionType(optionTypeNode); } } else { optionType_ = new OptionType(optionTypeNode); } } XmlNodeList settlementCurrencyNodeList = xmlNode.SelectNodes("settlementCurrency"); if (settlementCurrencyNodeList != null) { this.settlementCurrency_ = new List<IdentifiedCurrency>(); foreach (XmlNode item in settlementCurrencyNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] != null) { if (item.Attributes["id"] != null) { settlementCurrencyIDRef_ = item.Attributes["id"].Value; settlementCurrency_.Add(new IdentifiedCurrency(item)); IDManager.SetID(settlementCurrencyIDRef_, settlementCurrency_[settlementCurrency_.Count - 1 ]); } else if (item.Attributes["href"] != null) { settlementCurrencyIDRef_ = item.Attributes["href"].Value; } else { settlementCurrency_.Add(new IdentifiedCurrency(item)); } } else { settlementCurrency_.Add(new IdentifiedCurrency(item)); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); if (dayCountFractionNodeList != null) { this.dayCountFraction_ = new List<DayCountFraction>(); foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] != null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef_ = item.Attributes["id"].Value; dayCountFraction_.Add(new DayCountFraction(item)); IDManager.SetID(dayCountFractionIDRef_, dayCountFraction_[dayCountFraction_.Count - 1 ]); } else if (item.Attributes["href"] != null) { dayCountFractionIDRef_ = item.Attributes["href"].Value; } else { dayCountFraction_.Add(new DayCountFraction(item)); } } else { dayCountFraction_.Add(new DayCountFraction(item)); } } } }
public GenericProduct(XmlNode xmlNode) : base(xmlNode) { XmlNodeList multiLegNodeList = xmlNode.SelectNodes("multiLeg"); if (multiLegNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in multiLegNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { multiLegIDRef = item.Attributes["id"].Name; XsdTypeBoolean ob = XsdTypeBoolean(); IDManager.SetID(multiLegIDRef, ob); } else if (item.Attributes.ToString() == "href") { multiLegIDRef = item.Attributes["href"].Name; } else { multiLeg = new XsdTypeBoolean(item); } } } 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 counterpartyReferenceNodeList = xmlNode.SelectNodes("counterpartyReference"); foreach (XmlNode item in counterpartyReferenceNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { counterpartyReferenceIDRef = item.Attributes["id"].Name; List<PartyReference> ob = new List<PartyReference>(); ob.Add(new PartyReference(item)); IDManager.SetID(counterpartyReferenceIDRef, ob); } else if (item.Attributes.ToString() == "href") { counterpartyReferenceIDRef = item.Attributes["href"].Name; } else { counterpartyReference.Add(new PartyReference(item)); } } } 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; SimplePayment ob = SimplePayment(); IDManager.SetID(premiumIDRef, ob); } else if (item.Attributes.ToString() == "href") { premiumIDRef = item.Attributes["href"].Name; } else { premium = new SimplePayment(item); } } } 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; AdjustableDate2 ob = AdjustableDate2(); IDManager.SetID(effectiveDateIDRef, ob); } else if (item.Attributes.ToString() == "href") { effectiveDateIDRef = item.Attributes["href"].Name; } else { effectiveDate = new AdjustableDate2(item); } } } XmlNodeList expirationDateNodeList = xmlNode.SelectNodes("expirationDate"); if (expirationDateNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in expirationDateNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { expirationDateIDRef = item.Attributes["id"].Name; AdjustableDate2 ob = AdjustableDate2(); IDManager.SetID(expirationDateIDRef, ob); } else if (item.Attributes.ToString() == "href") { expirationDateIDRef = item.Attributes["href"].Name; } else { expirationDate = new AdjustableDate2(item); } } } XmlNodeList terminationDateNodeList = xmlNode.SelectNodes("terminationDate"); if (terminationDateNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in terminationDateNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { terminationDateIDRef = item.Attributes["id"].Name; AdjustableDate2 ob = AdjustableDate2(); IDManager.SetID(terminationDateIDRef, ob); } else if (item.Attributes.ToString() == "href") { terminationDateIDRef = item.Attributes["href"].Name; } else { terminationDate = new AdjustableDate2(item); } } } XmlNodeList underlyerNodeList = xmlNode.SelectNodes("underlyer"); foreach (XmlNode item in underlyerNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { underlyerIDRef = item.Attributes["id"].Name; List<TradeUnderlyer2> ob = new List<TradeUnderlyer2>(); ob.Add(new TradeUnderlyer2(item)); IDManager.SetID(underlyerIDRef, ob); } else if (item.Attributes.ToString() == "href") { underlyerIDRef = item.Attributes["href"].Name; } else { underlyer.Add(new TradeUnderlyer2(item)); } } } XmlNodeList notionalNodeList = xmlNode.SelectNodes("notional"); foreach (XmlNode item in notionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalIDRef = item.Attributes["id"].Name; List<CashflowNotional> ob = new List<CashflowNotional>(); ob.Add(new CashflowNotional(item)); IDManager.SetID(notionalIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalIDRef = item.Attributes["href"].Name; } else { notional.Add(new CashflowNotional(item)); } } } XmlNodeList optionTypeNodeList = xmlNode.SelectNodes("optionType"); if (optionTypeNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in optionTypeNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { optionTypeIDRef = item.Attributes["id"].Name; OptionType ob = OptionType(); IDManager.SetID(optionTypeIDRef, ob); } else if (item.Attributes.ToString() == "href") { optionTypeIDRef = item.Attributes["href"].Name; } else { optionType = new OptionType(item); } } } XmlNodeList settlementCurrencyNodeList = xmlNode.SelectNodes("settlementCurrency"); foreach (XmlNode item in settlementCurrencyNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { settlementCurrencyIDRef = item.Attributes["id"].Name; List<IdentifiedCurrency> ob = new List<IdentifiedCurrency>(); ob.Add(new IdentifiedCurrency(item)); IDManager.SetID(settlementCurrencyIDRef, ob); } else if (item.Attributes.ToString() == "href") { settlementCurrencyIDRef = item.Attributes["href"].Name; } else { settlementCurrency.Add(new IdentifiedCurrency(item)); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef = item.Attributes["id"].Name; List<DayCountFraction> ob = new List<DayCountFraction>(); ob.Add(new DayCountFraction(item)); IDManager.SetID(dayCountFractionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dayCountFractionIDRef = item.Attributes["href"].Name; } else { dayCountFraction.Add(new DayCountFraction(item)); } } } }