public Mortgage(XmlNode xmlNode) : base(xmlNode) { XmlNode insurerNode = xmlNode.SelectSingleNode("insurer"); if (insurerNode != null) { if (insurerNode.Attributes["href"] != null || insurerNode.Attributes["id"] != null) { if (insurerNode.Attributes["id"] != null) { insurerIDRef_ = insurerNode.Attributes["id"].Value; LegalEntity ob = new LegalEntity(insurerNode); IDManager.SetID(insurerIDRef_, ob); } else if (insurerNode.Attributes["href"] != null) { insurerIDRef_ = insurerNode.Attributes["href"].Value; } else { insurer_ = new LegalEntity(insurerNode); } } else { insurer_ = new LegalEntity(insurerNode); } } XmlNode insurerReferenceNode = xmlNode.SelectSingleNode("insurerReference"); if (insurerReferenceNode != null) { if (insurerReferenceNode.Attributes["href"] != null || insurerReferenceNode.Attributes["id"] != null) { if (insurerReferenceNode.Attributes["id"] != null) { insurerReferenceIDRef_ = insurerReferenceNode.Attributes["id"].Value; LegalEntityReference ob = new LegalEntityReference(insurerReferenceNode); IDManager.SetID(insurerReferenceIDRef_, ob); } else if (insurerReferenceNode.Attributes["href"] != null) { insurerReferenceIDRef_ = insurerReferenceNode.Attributes["href"].Value; } else { insurerReference_ = new LegalEntityReference(insurerReferenceNode); } } else { insurerReference_ = new LegalEntityReference(insurerReferenceNode); } } XmlNode issuerNameNode = xmlNode.SelectSingleNode("issuerName"); if (issuerNameNode != null) { if (issuerNameNode.Attributes["href"] != null || issuerNameNode.Attributes["id"] != null) { if (issuerNameNode.Attributes["id"] != null) { issuerNameIDRef_ = issuerNameNode.Attributes["id"].Value; XsdTypeString ob = new XsdTypeString(issuerNameNode); IDManager.SetID(issuerNameIDRef_, ob); } else if (issuerNameNode.Attributes["href"] != null) { issuerNameIDRef_ = issuerNameNode.Attributes["href"].Value; } else { issuerName_ = new XsdTypeString(issuerNameNode); } } else { issuerName_ = new XsdTypeString(issuerNameNode); } } XmlNode issuerPartyReferenceNode = xmlNode.SelectSingleNode("issuerPartyReference"); if (issuerPartyReferenceNode != null) { if (issuerPartyReferenceNode.Attributes["href"] != null || issuerPartyReferenceNode.Attributes["id"] != null) { if (issuerPartyReferenceNode.Attributes["id"] != null) { issuerPartyReferenceIDRef_ = issuerPartyReferenceNode.Attributes["id"].Value; PartyReference ob = new PartyReference(issuerPartyReferenceNode); IDManager.SetID(issuerPartyReferenceIDRef_, ob); } else if (issuerPartyReferenceNode.Attributes["href"] != null) { issuerPartyReferenceIDRef_ = issuerPartyReferenceNode.Attributes["href"].Value; } else { issuerPartyReference_ = new PartyReference(issuerPartyReferenceNode); } } else { issuerPartyReference_ = new PartyReference(issuerPartyReferenceNode); } } XmlNode seniorityNode = xmlNode.SelectSingleNode("seniority"); if (seniorityNode != null) { if (seniorityNode.Attributes["href"] != null || seniorityNode.Attributes["id"] != null) { if (seniorityNode.Attributes["id"] != null) { seniorityIDRef_ = seniorityNode.Attributes["id"].Value; CreditSeniority ob = new CreditSeniority(seniorityNode); IDManager.SetID(seniorityIDRef_, ob); } else if (seniorityNode.Attributes["href"] != null) { seniorityIDRef_ = seniorityNode.Attributes["href"].Value; } else { seniority_ = new CreditSeniority(seniorityNode); } } else { seniority_ = new CreditSeniority(seniorityNode); } } XmlNode couponTypeNode = xmlNode.SelectSingleNode("couponType"); if (couponTypeNode != null) { if (couponTypeNode.Attributes["href"] != null || couponTypeNode.Attributes["id"] != null) { if (couponTypeNode.Attributes["id"] != null) { couponTypeIDRef_ = couponTypeNode.Attributes["id"].Value; CouponType ob = new CouponType(couponTypeNode); IDManager.SetID(couponTypeIDRef_, ob); } else if (couponTypeNode.Attributes["href"] != null) { couponTypeIDRef_ = couponTypeNode.Attributes["href"].Value; } else { couponType_ = new CouponType(couponTypeNode); } } else { couponType_ = new CouponType(couponTypeNode); } } XmlNode couponRateNode = xmlNode.SelectSingleNode("couponRate"); if (couponRateNode != null) { if (couponRateNode.Attributes["href"] != null || couponRateNode.Attributes["id"] != null) { if (couponRateNode.Attributes["id"] != null) { couponRateIDRef_ = couponRateNode.Attributes["id"].Value; XsdTypeDecimal ob = new XsdTypeDecimal(couponRateNode); IDManager.SetID(couponRateIDRef_, ob); } else if (couponRateNode.Attributes["href"] != null) { couponRateIDRef_ = couponRateNode.Attributes["href"].Value; } else { couponRate_ = new XsdTypeDecimal(couponRateNode); } } else { couponRate_ = new XsdTypeDecimal(couponRateNode); } } XmlNode maturityNode = xmlNode.SelectSingleNode("maturity"); if (maturityNode != null) { if (maturityNode.Attributes["href"] != null || maturityNode.Attributes["id"] != null) { if (maturityNode.Attributes["id"] != null) { maturityIDRef_ = maturityNode.Attributes["id"].Value; XsdTypeDate ob = new XsdTypeDate(maturityNode); IDManager.SetID(maturityIDRef_, ob); } else if (maturityNode.Attributes["href"] != null) { maturityIDRef_ = maturityNode.Attributes["href"].Value; } else { maturity_ = new XsdTypeDate(maturityNode); } } else { maturity_ = new XsdTypeDate(maturityNode); } } XmlNode paymentFrequencyNode = xmlNode.SelectSingleNode("paymentFrequency"); if (paymentFrequencyNode != null) { if (paymentFrequencyNode.Attributes["href"] != null || paymentFrequencyNode.Attributes["id"] != null) { if (paymentFrequencyNode.Attributes["id"] != null) { paymentFrequencyIDRef_ = paymentFrequencyNode.Attributes["id"].Value; Period ob = new Period(paymentFrequencyNode); IDManager.SetID(paymentFrequencyIDRef_, ob); } else if (paymentFrequencyNode.Attributes["href"] != null) { paymentFrequencyIDRef_ = paymentFrequencyNode.Attributes["href"].Value; } else { paymentFrequency_ = new Period(paymentFrequencyNode); } } else { paymentFrequency_ = new Period(paymentFrequencyNode); } } XmlNode dayCountFractionNode = xmlNode.SelectSingleNode("dayCountFraction"); if (dayCountFractionNode != null) { if (dayCountFractionNode.Attributes["href"] != null || dayCountFractionNode.Attributes["id"] != null) { if (dayCountFractionNode.Attributes["id"] != null) { dayCountFractionIDRef_ = dayCountFractionNode.Attributes["id"].Value; DayCountFraction ob = new DayCountFraction(dayCountFractionNode); IDManager.SetID(dayCountFractionIDRef_, ob); } else if (dayCountFractionNode.Attributes["href"] != null) { dayCountFractionIDRef_ = dayCountFractionNode.Attributes["href"].Value; } else { dayCountFraction_ = new DayCountFraction(dayCountFractionNode); } } else { dayCountFraction_ = new DayCountFraction(dayCountFractionNode); } } XmlNode originalPrincipalAmountNode = xmlNode.SelectSingleNode("originalPrincipalAmount"); if (originalPrincipalAmountNode != null) { if (originalPrincipalAmountNode.Attributes["href"] != null || originalPrincipalAmountNode.Attributes["id"] != null) { if (originalPrincipalAmountNode.Attributes["id"] != null) { originalPrincipalAmountIDRef_ = originalPrincipalAmountNode.Attributes["id"].Value; XsdTypeDecimal ob = new XsdTypeDecimal(originalPrincipalAmountNode); IDManager.SetID(originalPrincipalAmountIDRef_, ob); } else if (originalPrincipalAmountNode.Attributes["href"] != null) { originalPrincipalAmountIDRef_ = originalPrincipalAmountNode.Attributes["href"].Value; } else { originalPrincipalAmount_ = new XsdTypeDecimal(originalPrincipalAmountNode); } } else { originalPrincipalAmount_ = new XsdTypeDecimal(originalPrincipalAmountNode); } } XmlNode poolNode = xmlNode.SelectSingleNode("pool"); if (poolNode != null) { if (poolNode.Attributes["href"] != null || poolNode.Attributes["id"] != null) { if (poolNode.Attributes["id"] != null) { poolIDRef_ = poolNode.Attributes["id"].Value; AssetPool ob = new AssetPool(poolNode); IDManager.SetID(poolIDRef_, ob); } else if (poolNode.Attributes["href"] != null) { poolIDRef_ = poolNode.Attributes["href"].Value; } else { pool_ = new AssetPool(poolNode); } } else { pool_ = new AssetPool(poolNode); } } XmlNode sectorNode = xmlNode.SelectSingleNode("sector"); if (sectorNode != null) { if (sectorNode.Attributes["href"] != null || sectorNode.Attributes["id"] != null) { if (sectorNode.Attributes["id"] != null) { sectorIDRef_ = sectorNode.Attributes["id"].Value; MortgageSector ob = new MortgageSector(sectorNode); IDManager.SetID(sectorIDRef_, ob); } else if (sectorNode.Attributes["href"] != null) { sectorIDRef_ = sectorNode.Attributes["href"].Value; } else { sector_ = new MortgageSector(sectorNode); } } else { sector_ = new MortgageSector(sectorNode); } } XmlNode trancheNode = xmlNode.SelectSingleNode("tranche"); if (trancheNode != null) { if (trancheNode.Attributes["href"] != null || trancheNode.Attributes["id"] != null) { if (trancheNode.Attributes["id"] != null) { trancheIDRef_ = trancheNode.Attributes["id"].Value; XsdTypeToken ob = new XsdTypeToken(trancheNode); IDManager.SetID(trancheIDRef_, ob); } else if (trancheNode.Attributes["href"] != null) { trancheIDRef_ = trancheNode.Attributes["href"].Value; } else { tranche_ = new XsdTypeToken(trancheNode); } } else { tranche_ = new XsdTypeToken(trancheNode); } } }
public Mortgage(XmlNode xmlNode) : base(xmlNode) { XmlNodeList insurerNodeList = xmlNode.SelectNodes("insurer"); if (insurerNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in insurerNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { insurerIDRef = item.Attributes["id"].Name; LegalEntity ob = LegalEntity(); IDManager.SetID(insurerIDRef, ob); } else if (item.Attributes.ToString() == "href") { insurerIDRef = item.Attributes["href"].Name; } else { insurer = new LegalEntity(item); } } } XmlNodeList insurerReferenceNodeList = xmlNode.SelectNodes("insurerReference"); if (insurerReferenceNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in insurerReferenceNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { insurerReferenceIDRef = item.Attributes["id"].Name; LegalEntityReference ob = LegalEntityReference(); IDManager.SetID(insurerReferenceIDRef, ob); } else if (item.Attributes.ToString() == "href") { insurerReferenceIDRef = item.Attributes["href"].Name; } else { insurerReference = new LegalEntityReference(item); } } } XmlNodeList issuerNameNodeList = xmlNode.SelectNodes("issuerName"); if (issuerNameNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in issuerNameNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { issuerNameIDRef = item.Attributes["id"].Name; XsdTypeString ob = XsdTypeString(); IDManager.SetID(issuerNameIDRef, ob); } else if (item.Attributes.ToString() == "href") { issuerNameIDRef = item.Attributes["href"].Name; } else { issuerName = new XsdTypeString(item); } } } XmlNodeList issuerPartyReferenceNodeList = xmlNode.SelectNodes("issuerPartyReference"); if (issuerPartyReferenceNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in issuerPartyReferenceNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { issuerPartyReferenceIDRef = item.Attributes["id"].Name; PartyReference ob = PartyReference(); IDManager.SetID(issuerPartyReferenceIDRef, ob); } else if (item.Attributes.ToString() == "href") { issuerPartyReferenceIDRef = item.Attributes["href"].Name; } else { issuerPartyReference = new PartyReference(item); } } } XmlNodeList seniorityNodeList = xmlNode.SelectNodes("seniority"); if (seniorityNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in seniorityNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { seniorityIDRef = item.Attributes["id"].Name; CreditSeniority ob = CreditSeniority(); IDManager.SetID(seniorityIDRef, ob); } else if (item.Attributes.ToString() == "href") { seniorityIDRef = item.Attributes["href"].Name; } else { seniority = new CreditSeniority(item); } } } XmlNodeList couponTypeNodeList = xmlNode.SelectNodes("couponType"); if (couponTypeNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in couponTypeNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { couponTypeIDRef = item.Attributes["id"].Name; CouponType ob = CouponType(); IDManager.SetID(couponTypeIDRef, ob); } else if (item.Attributes.ToString() == "href") { couponTypeIDRef = item.Attributes["href"].Name; } else { couponType = new CouponType(item); } } } XmlNodeList couponRateNodeList = xmlNode.SelectNodes("couponRate"); if (couponRateNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in couponRateNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { couponRateIDRef = item.Attributes["id"].Name; XsdTypeDecimal ob = XsdTypeDecimal(); IDManager.SetID(couponRateIDRef, ob); } else if (item.Attributes.ToString() == "href") { couponRateIDRef = item.Attributes["href"].Name; } else { couponRate = new XsdTypeDecimal(item); } } } XmlNodeList maturityNodeList = xmlNode.SelectNodes("maturity"); if (maturityNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in maturityNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { maturityIDRef = item.Attributes["id"].Name; XsdTypeDate ob = XsdTypeDate(); IDManager.SetID(maturityIDRef, ob); } else if (item.Attributes.ToString() == "href") { maturityIDRef = item.Attributes["href"].Name; } else { maturity = new XsdTypeDate(item); } } } XmlNodeList paymentFrequencyNodeList = xmlNode.SelectNodes("paymentFrequency"); if (paymentFrequencyNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in paymentFrequencyNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { paymentFrequencyIDRef = item.Attributes["id"].Name; Period ob = Period(); IDManager.SetID(paymentFrequencyIDRef, ob); } else if (item.Attributes.ToString() == "href") { paymentFrequencyIDRef = item.Attributes["href"].Name; } else { paymentFrequency = new Period(item); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); if (dayCountFractionNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef = item.Attributes["id"].Name; DayCountFraction ob = DayCountFraction(); IDManager.SetID(dayCountFractionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dayCountFractionIDRef = item.Attributes["href"].Name; } else { dayCountFraction = new DayCountFraction(item); } } } XmlNodeList originalPrincipalAmountNodeList = xmlNode.SelectNodes("originalPrincipalAmount"); if (originalPrincipalAmountNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in originalPrincipalAmountNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { originalPrincipalAmountIDRef = item.Attributes["id"].Name; XsdTypeDecimal ob = XsdTypeDecimal(); IDManager.SetID(originalPrincipalAmountIDRef, ob); } else if (item.Attributes.ToString() == "href") { originalPrincipalAmountIDRef = item.Attributes["href"].Name; } else { originalPrincipalAmount = new XsdTypeDecimal(item); } } } XmlNodeList poolNodeList = xmlNode.SelectNodes("pool"); if (poolNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in poolNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { poolIDRef = item.Attributes["id"].Name; AssetPool ob = AssetPool(); IDManager.SetID(poolIDRef, ob); } else if (item.Attributes.ToString() == "href") { poolIDRef = item.Attributes["href"].Name; } else { pool = new AssetPool(item); } } } XmlNodeList sectorNodeList = xmlNode.SelectNodes("sector"); if (sectorNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in sectorNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { sectorIDRef = item.Attributes["id"].Name; MortgageSector ob = MortgageSector(); IDManager.SetID(sectorIDRef, ob); } else if (item.Attributes.ToString() == "href") { sectorIDRef = item.Attributes["href"].Name; } else { sector = new MortgageSector(item); } } } XmlNodeList trancheNodeList = xmlNode.SelectNodes("tranche"); if (trancheNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in trancheNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { trancheIDRef = item.Attributes["id"].Name; XsdTypeToken ob = XsdTypeToken(); IDManager.SetID(trancheIDRef, ob); } else if (item.Attributes.ToString() == "href") { trancheIDRef = item.Attributes["href"].Name; } else { tranche = new XsdTypeToken(item); } } } }