public ReturnLeg(XmlNode xmlNode) : base(xmlNode) { XmlNode rateOfReturnNode = xmlNode.SelectSingleNode("rateOfReturn"); if (rateOfReturnNode != null) { if (rateOfReturnNode.Attributes["href"] != null || rateOfReturnNode.Attributes["id"] != null) { if (rateOfReturnNode.Attributes["id"] != null) { rateOfReturnIDRef_ = rateOfReturnNode.Attributes["id"].Value; ReturnLegValuation ob = new ReturnLegValuation(rateOfReturnNode); IDManager.SetID(rateOfReturnIDRef_, ob); } else if (rateOfReturnNode.Attributes["href"] != null) { rateOfReturnIDRef_ = rateOfReturnNode.Attributes["href"].Value; } else { rateOfReturn_ = new ReturnLegValuation(rateOfReturnNode); } } else { rateOfReturn_ = new ReturnLegValuation(rateOfReturnNode); } } XmlNode notionalNode = xmlNode.SelectSingleNode("notional"); if (notionalNode != null) { if (notionalNode.Attributes["href"] != null || notionalNode.Attributes["id"] != null) { if (notionalNode.Attributes["id"] != null) { notionalIDRef_ = notionalNode.Attributes["id"].Value; ReturnSwapNotional ob = new ReturnSwapNotional(notionalNode); IDManager.SetID(notionalIDRef_, ob); } else if (notionalNode.Attributes["href"] != null) { notionalIDRef_ = notionalNode.Attributes["href"].Value; } else { notional_ = new ReturnSwapNotional(notionalNode); } } else { notional_ = new ReturnSwapNotional(notionalNode); } } XmlNode amountNode = xmlNode.SelectSingleNode("amount"); if (amountNode != null) { if (amountNode.Attributes["href"] != null || amountNode.Attributes["id"] != null) { if (amountNode.Attributes["id"] != null) { amountIDRef_ = amountNode.Attributes["id"].Value; ReturnSwapAmount ob = new ReturnSwapAmount(amountNode); IDManager.SetID(amountIDRef_, ob); } else if (amountNode.Attributes["href"] != null) { amountIDRef_ = amountNode.Attributes["href"].Value; } else { amount_ = new ReturnSwapAmount(amountNode); } } else { amount_ = new ReturnSwapAmount(amountNode); } } XmlNode returnNode = xmlNode.SelectSingleNode("return"); if (returnNode != null) { if (returnNode.Attributes["href"] != null || returnNode.Attributes["id"] != null) { if (returnNode.Attributes["id"] != null) { returnIDRef_ = returnNode.Attributes["id"].Value; Return ob = new Return(returnNode); IDManager.SetID(returnIDRef_, ob); } else if (returnNode.Attributes["href"] != null) { returnIDRef_ = returnNode.Attributes["href"].Value; } else { return_ = new Return(returnNode); } } else { return_ = new Return(returnNode); } } XmlNode notionalAdjustmentsNode = xmlNode.SelectSingleNode("notionalAdjustments"); if (notionalAdjustmentsNode != null) { if (notionalAdjustmentsNode.Attributes["href"] != null || notionalAdjustmentsNode.Attributes["id"] != null) { if (notionalAdjustmentsNode.Attributes["id"] != null) { notionalAdjustmentsIDRef_ = notionalAdjustmentsNode.Attributes["id"].Value; NotionalAdjustmentEnum ob = new NotionalAdjustmentEnum(notionalAdjustmentsNode); IDManager.SetID(notionalAdjustmentsIDRef_, ob); } else if (notionalAdjustmentsNode.Attributes["href"] != null) { notionalAdjustmentsIDRef_ = notionalAdjustmentsNode.Attributes["href"].Value; } else { notionalAdjustments_ = new NotionalAdjustmentEnum(notionalAdjustmentsNode); } } else { notionalAdjustments_ = new NotionalAdjustmentEnum(notionalAdjustmentsNode); } } XmlNode fxFeatureNode = xmlNode.SelectSingleNode("fxFeature"); if (fxFeatureNode != null) { if (fxFeatureNode.Attributes["href"] != null || fxFeatureNode.Attributes["id"] != null) { if (fxFeatureNode.Attributes["id"] != null) { fxFeatureIDRef_ = fxFeatureNode.Attributes["id"].Value; FxFeature ob = new FxFeature(fxFeatureNode); IDManager.SetID(fxFeatureIDRef_, ob); } else if (fxFeatureNode.Attributes["href"] != null) { fxFeatureIDRef_ = fxFeatureNode.Attributes["href"].Value; } else { fxFeature_ = new FxFeature(fxFeatureNode); } } else { fxFeature_ = new FxFeature(fxFeatureNode); } } XmlNode averagingDatesNode = xmlNode.SelectSingleNode("averagingDates"); if (averagingDatesNode != null) { if (averagingDatesNode.Attributes["href"] != null || averagingDatesNode.Attributes["id"] != null) { if (averagingDatesNode.Attributes["id"] != null) { averagingDatesIDRef_ = averagingDatesNode.Attributes["id"].Value; AveragingPeriod ob = new AveragingPeriod(averagingDatesNode); IDManager.SetID(averagingDatesIDRef_, ob); } else if (averagingDatesNode.Attributes["href"] != null) { averagingDatesIDRef_ = averagingDatesNode.Attributes["href"].Value; } else { averagingDates_ = new AveragingPeriod(averagingDatesNode); } } else { averagingDates_ = new AveragingPeriod(averagingDatesNode); } } }
public ReturnLeg(XmlNode xmlNode) : base(xmlNode) { XmlNodeList rateOfReturnNodeList = xmlNode.SelectNodes("rateOfReturn"); if (rateOfReturnNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in rateOfReturnNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { rateOfReturnIDRef = item.Attributes["id"].Name; ReturnLegValuation ob = ReturnLegValuation(); IDManager.SetID(rateOfReturnIDRef, ob); } else if (item.Attributes.ToString() == "href") { rateOfReturnIDRef = item.Attributes["href"].Name; } else { rateOfReturn = new ReturnLegValuation(item); } } } XmlNodeList notionalNodeList = xmlNode.SelectNodes("notional"); if (notionalNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in notionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalIDRef = item.Attributes["id"].Name; ReturnSwapNotional ob = ReturnSwapNotional(); IDManager.SetID(notionalIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalIDRef = item.Attributes["href"].Name; } else { notional = new ReturnSwapNotional(item); } } } XmlNodeList amountNodeList = xmlNode.SelectNodes("amount"); if (amountNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in amountNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { amountIDRef = item.Attributes["id"].Name; ReturnSwapAmount ob = ReturnSwapAmount(); IDManager.SetID(amountIDRef, ob); } else if (item.Attributes.ToString() == "href") { amountIDRef = item.Attributes["href"].Name; } else { amount = new ReturnSwapAmount(item); } } } XmlNodeList returnNodeList = xmlNode.SelectNodes("return"); if (returnNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in returnNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { returnIDRef = item.Attributes["id"].Name; Return ob = Return(); IDManager.SetID(returnIDRef, ob); } else if (item.Attributes.ToString() == "href") { returnIDRef = item.Attributes["href"].Name; } else { return( = new Return(item)); } } } XmlNodeList notionalAdjustmentsNodeList = xmlNode.SelectNodes("notionalAdjustments"); if (notionalAdjustmentsNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in notionalAdjustmentsNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalAdjustmentsIDRef = item.Attributes["id"].Name; NotionalAdjustmentEnum ob = NotionalAdjustmentEnum(); IDManager.SetID(notionalAdjustmentsIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalAdjustmentsIDRef = item.Attributes["href"].Name; } else { notionalAdjustments = new NotionalAdjustmentEnum(item); } } } XmlNodeList fxFeatureNodeList = xmlNode.SelectNodes("fxFeature"); if (fxFeatureNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in fxFeatureNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fxFeatureIDRef = item.Attributes["id"].Name; FxFeature ob = FxFeature(); IDManager.SetID(fxFeatureIDRef, ob); } else if (item.Attributes.ToString() == "href") { fxFeatureIDRef = item.Attributes["href"].Name; } else { fxFeature = new FxFeature(item); } } } XmlNodeList averagingDatesNodeList = xmlNode.SelectNodes("averagingDates"); if (averagingDatesNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in averagingDatesNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { averagingDatesIDRef = item.Attributes["id"].Name; AveragingPeriod ob = AveragingPeriod(); IDManager.SetID(averagingDatesIDRef, ob); } else if (item.Attributes.ToString() == "href") { averagingDatesIDRef = item.Attributes["href"].Name; } else { averagingDates = new AveragingPeriod(item); } } } }