Пример #1
0
        public CommodityForward(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList valueDateNodeList = xmlNode.SelectNodes("valueDate");

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

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


            XmlNodeList fixedLegNodeList = xmlNode.SelectNodes("fixedLeg");

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

            foreach (XmlNode item in fixedLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fixedLegIDRef = item.Attributes["id"].Name;
                        NonPeriodicFixedPriceLeg ob = NonPeriodicFixedPriceLeg();
                        IDManager.SetID(fixedLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fixedLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fixedLeg = new NonPeriodicFixedPriceLeg(item);
                    }
                }
            }


            XmlNodeList averagePriceLegNodeList = xmlNode.SelectNodes("averagePriceLeg");

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

            foreach (XmlNode item in averagePriceLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        averagePriceLegIDRef = item.Attributes["id"].Name;
                        AveragePriceLeg ob = AveragePriceLeg();
                        IDManager.SetID(averagePriceLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        averagePriceLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        averagePriceLeg = new AveragePriceLeg(item);
                    }
                }
            }


            XmlNodeList commodityForwardLegNodeList = xmlNode.SelectNodes("commodityForwardLeg");

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

            foreach (XmlNode item in commodityForwardLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        commodityForwardLegIDRef = item.Attributes["id"].Name;
                        CommodityForwardLeg ob = CommodityForwardLeg();
                        IDManager.SetID(commodityForwardLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        commodityForwardLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        commodityForwardLeg = new CommodityForwardLeg(item);
                    }
                }
            }


            XmlNodeList bullionPhysicalLegNodeList = xmlNode.SelectNodes("bullionPhysicalLeg");

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

            foreach (XmlNode item in bullionPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        bullionPhysicalLegIDRef = item.Attributes["id"].Name;
                        BullionPhysicalLeg ob = BullionPhysicalLeg();
                        IDManager.SetID(bullionPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        bullionPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        bullionPhysicalLeg = new BullionPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList metalPhysicalLegNodeList = xmlNode.SelectNodes("metalPhysicalLeg");

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

            foreach (XmlNode item in metalPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        metalPhysicalLegIDRef = item.Attributes["id"].Name;
                        MetalPhysicalLeg ob = MetalPhysicalLeg();
                        IDManager.SetID(metalPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        metalPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        metalPhysicalLeg = new MetalPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");

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

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


            XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");

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

            foreach (XmlNode item in marketDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityMarketDisruption ob = CommodityMarketDisruption();
                        IDManager.SetID(marketDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        marketDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        marketDisruption = new CommodityMarketDisruption(item);
                    }
                }
            }


            XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");

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

            foreach (XmlNode item in settlementDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                        IDManager.SetID(settlementDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
                    }
                }
            }


            XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");

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

            foreach (XmlNode item in roundingNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        roundingIDRef = item.Attributes["id"].Name;
                        Rounding ob = Rounding();
                        IDManager.SetID(roundingIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        roundingIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        rounding = new Rounding(item);
                    }
                }
            }
        }
 public CommodityOption(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);
         }
     }
     
 
     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;
                 PutCallEnum ob = new PutCallEnum(optionTypeNode);
                 IDManager.SetID(optionTypeIDRef_, ob);
             }
             else if (optionTypeNode.Attributes["href"] != null)
             {
                 optionTypeIDRef_ = optionTypeNode.Attributes["href"].Value;
             }
             else
             {
                 optionType_ = new PutCallEnum(optionTypeNode);
             }
         }
         else
         {
             optionType_ = new PutCallEnum(optionTypeNode);
         }
     }
     
 
     XmlNode commodityNode = xmlNode.SelectSingleNode("commodity");
     
     if (commodityNode != null)
     {
         if (commodityNode.Attributes["href"] != null || commodityNode.Attributes["id"] != null) 
         {
             if (commodityNode.Attributes["id"] != null) 
             {
                 commodityIDRef_ = commodityNode.Attributes["id"].Value;
                 Commodity ob = new Commodity(commodityNode);
                 IDManager.SetID(commodityIDRef_, ob);
             }
             else if (commodityNode.Attributes["href"] != null)
             {
                 commodityIDRef_ = commodityNode.Attributes["href"].Value;
             }
             else
             {
                 commodity_ = new Commodity(commodityNode);
             }
         }
         else
         {
             commodity_ = new Commodity(commodityNode);
         }
     }
     
 
     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 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;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(terminationDateNode);
                 IDManager.SetID(terminationDateIDRef_, ob);
             }
             else if (terminationDateNode.Attributes["href"] != null)
             {
                 terminationDateIDRef_ = terminationDateNode.Attributes["href"].Value;
             }
             else
             {
                 terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
             }
         }
         else
         {
             terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
         }
     }
     
 
     XmlNode calculationPeriodsScheduleNode = xmlNode.SelectSingleNode("calculationPeriodsSchedule");
     
     if (calculationPeriodsScheduleNode != null)
     {
         if (calculationPeriodsScheduleNode.Attributes["href"] != null || calculationPeriodsScheduleNode.Attributes["id"] != null) 
         {
             if (calculationPeriodsScheduleNode.Attributes["id"] != null) 
             {
                 calculationPeriodsScheduleIDRef_ = calculationPeriodsScheduleNode.Attributes["id"].Value;
                 CommodityCalculationPeriodsSchedule ob = new CommodityCalculationPeriodsSchedule(calculationPeriodsScheduleNode);
                 IDManager.SetID(calculationPeriodsScheduleIDRef_, ob);
             }
             else if (calculationPeriodsScheduleNode.Attributes["href"] != null)
             {
                 calculationPeriodsScheduleIDRef_ = calculationPeriodsScheduleNode.Attributes["href"].Value;
             }
             else
             {
                 calculationPeriodsSchedule_ = new CommodityCalculationPeriodsSchedule(calculationPeriodsScheduleNode);
             }
         }
         else
         {
             calculationPeriodsSchedule_ = new CommodityCalculationPeriodsSchedule(calculationPeriodsScheduleNode);
         }
     }
     
 
     XmlNode calculationPeriodsNode = xmlNode.SelectSingleNode("calculationPeriods");
     
     if (calculationPeriodsNode != null)
     {
         if (calculationPeriodsNode.Attributes["href"] != null || calculationPeriodsNode.Attributes["id"] != null) 
         {
             if (calculationPeriodsNode.Attributes["id"] != null) 
             {
                 calculationPeriodsIDRef_ = calculationPeriodsNode.Attributes["id"].Value;
                 AdjustableDates ob = new AdjustableDates(calculationPeriodsNode);
                 IDManager.SetID(calculationPeriodsIDRef_, ob);
             }
             else if (calculationPeriodsNode.Attributes["href"] != null)
             {
                 calculationPeriodsIDRef_ = calculationPeriodsNode.Attributes["href"].Value;
             }
             else
             {
                 calculationPeriods_ = new AdjustableDates(calculationPeriodsNode);
             }
         }
         else
         {
             calculationPeriods_ = new AdjustableDates(calculationPeriodsNode);
         }
     }
     
 
     XmlNode pricingDatesNode = xmlNode.SelectSingleNode("pricingDates");
     
     if (pricingDatesNode != null)
     {
         if (pricingDatesNode.Attributes["href"] != null || pricingDatesNode.Attributes["id"] != null) 
         {
             if (pricingDatesNode.Attributes["id"] != null) 
             {
                 pricingDatesIDRef_ = pricingDatesNode.Attributes["id"].Value;
                 CommodityPricingDates ob = new CommodityPricingDates(pricingDatesNode);
                 IDManager.SetID(pricingDatesIDRef_, ob);
             }
             else if (pricingDatesNode.Attributes["href"] != null)
             {
                 pricingDatesIDRef_ = pricingDatesNode.Attributes["href"].Value;
             }
             else
             {
                 pricingDates_ = new CommodityPricingDates(pricingDatesNode);
             }
         }
         else
         {
             pricingDates_ = new CommodityPricingDates(pricingDatesNode);
         }
     }
     
 
     XmlNode averagingMethodNode = xmlNode.SelectSingleNode("averagingMethod");
     
     if (averagingMethodNode != null)
     {
         if (averagingMethodNode.Attributes["href"] != null || averagingMethodNode.Attributes["id"] != null) 
         {
             if (averagingMethodNode.Attributes["id"] != null) 
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["id"].Value;
                 AveragingMethodEnum ob = new AveragingMethodEnum(averagingMethodNode);
                 IDManager.SetID(averagingMethodIDRef_, ob);
             }
             else if (averagingMethodNode.Attributes["href"] != null)
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["href"].Value;
             }
             else
             {
                 averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
             }
         }
         else
         {
             averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
         }
     }
     
 
     XmlNode notionalQuantityScheduleNode = xmlNode.SelectSingleNode("notionalQuantitySchedule");
     
     if (notionalQuantityScheduleNode != null)
     {
         if (notionalQuantityScheduleNode.Attributes["href"] != null || notionalQuantityScheduleNode.Attributes["id"] != null) 
         {
             if (notionalQuantityScheduleNode.Attributes["id"] != null) 
             {
                 notionalQuantityScheduleIDRef_ = notionalQuantityScheduleNode.Attributes["id"].Value;
                 CommodityNotionalQuantitySchedule ob = new CommodityNotionalQuantitySchedule(notionalQuantityScheduleNode);
                 IDManager.SetID(notionalQuantityScheduleIDRef_, ob);
             }
             else if (notionalQuantityScheduleNode.Attributes["href"] != null)
             {
                 notionalQuantityScheduleIDRef_ = notionalQuantityScheduleNode.Attributes["href"].Value;
             }
             else
             {
                 notionalQuantitySchedule_ = new CommodityNotionalQuantitySchedule(notionalQuantityScheduleNode);
             }
         }
         else
         {
             notionalQuantitySchedule_ = new CommodityNotionalQuantitySchedule(notionalQuantityScheduleNode);
         }
     }
     
 
     XmlNode notionalQuantityNode = xmlNode.SelectSingleNode("notionalQuantity");
     
     if (notionalQuantityNode != null)
     {
         if (notionalQuantityNode.Attributes["href"] != null || notionalQuantityNode.Attributes["id"] != null) 
         {
             if (notionalQuantityNode.Attributes["id"] != null) 
             {
                 notionalQuantityIDRef_ = notionalQuantityNode.Attributes["id"].Value;
                 CommodityNotionalQuantity ob = new CommodityNotionalQuantity(notionalQuantityNode);
                 IDManager.SetID(notionalQuantityIDRef_, ob);
             }
             else if (notionalQuantityNode.Attributes["href"] != null)
             {
                 notionalQuantityIDRef_ = notionalQuantityNode.Attributes["href"].Value;
             }
             else
             {
                 notionalQuantity_ = new CommodityNotionalQuantity(notionalQuantityNode);
             }
         }
         else
         {
             notionalQuantity_ = new CommodityNotionalQuantity(notionalQuantityNode);
         }
     }
     
 
     XmlNodeList settlementPeriodsNotionalQuantityNodeList = xmlNode.SelectNodes("settlementPeriodsNotionalQuantity");
     
     if (settlementPeriodsNotionalQuantityNodeList != null)
     {
         this.settlementPeriodsNotionalQuantity_ = new List<CommoditySettlementPeriodsNotionalQuantity>();
         foreach (XmlNode item in settlementPeriodsNotionalQuantityNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     settlementPeriodsNotionalQuantityIDRef_ = item.Attributes["id"].Value;
                     settlementPeriodsNotionalQuantity_.Add(new CommoditySettlementPeriodsNotionalQuantity(item));
                     IDManager.SetID(settlementPeriodsNotionalQuantityIDRef_, settlementPeriodsNotionalQuantity_[settlementPeriodsNotionalQuantity_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     settlementPeriodsNotionalQuantityIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 settlementPeriodsNotionalQuantity_.Add(new CommoditySettlementPeriodsNotionalQuantity(item));
                 }
             }
             else
             {
                 settlementPeriodsNotionalQuantity_.Add(new CommoditySettlementPeriodsNotionalQuantity(item));
             }
         }
     }
     
 
     XmlNode totalNotionalQuantityNode = xmlNode.SelectSingleNode("totalNotionalQuantity");
     
     if (totalNotionalQuantityNode != null)
     {
         if (totalNotionalQuantityNode.Attributes["href"] != null || totalNotionalQuantityNode.Attributes["id"] != null) 
         {
             if (totalNotionalQuantityNode.Attributes["id"] != null) 
             {
                 totalNotionalQuantityIDRef_ = totalNotionalQuantityNode.Attributes["id"].Value;
                 XsdTypeDecimal ob = new XsdTypeDecimal(totalNotionalQuantityNode);
                 IDManager.SetID(totalNotionalQuantityIDRef_, ob);
             }
             else if (totalNotionalQuantityNode.Attributes["href"] != null)
             {
                 totalNotionalQuantityIDRef_ = totalNotionalQuantityNode.Attributes["href"].Value;
             }
             else
             {
                 totalNotionalQuantity_ = new XsdTypeDecimal(totalNotionalQuantityNode);
             }
         }
         else
         {
             totalNotionalQuantity_ = new XsdTypeDecimal(totalNotionalQuantityNode);
         }
     }
     
 
     XmlNode quantityReferenceNode = xmlNode.SelectSingleNode("quantityReference");
     
     if (quantityReferenceNode != null)
     {
         if (quantityReferenceNode.Attributes["href"] != null || quantityReferenceNode.Attributes["id"] != null) 
         {
             if (quantityReferenceNode.Attributes["id"] != null) 
             {
                 quantityReferenceIDRef_ = quantityReferenceNode.Attributes["id"].Value;
                 QuantityReference ob = new QuantityReference(quantityReferenceNode);
                 IDManager.SetID(quantityReferenceIDRef_, ob);
             }
             else if (quantityReferenceNode.Attributes["href"] != null)
             {
                 quantityReferenceIDRef_ = quantityReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 quantityReference_ = new QuantityReference(quantityReferenceNode);
             }
         }
         else
         {
             quantityReference_ = new QuantityReference(quantityReferenceNode);
         }
     }
     
 
     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;
                 CommodityExercise ob = new CommodityExercise(exerciseNode);
                 IDManager.SetID(exerciseIDRef_, ob);
             }
             else if (exerciseNode.Attributes["href"] != null)
             {
                 exerciseIDRef_ = exerciseNode.Attributes["href"].Value;
             }
             else
             {
                 exercise_ = new CommodityExercise(exerciseNode);
             }
         }
         else
         {
             exercise_ = new CommodityExercise(exerciseNode);
         }
     }
     
 
     XmlNode strikePricePerUnitNode = xmlNode.SelectSingleNode("strikePricePerUnit");
     
     if (strikePricePerUnitNode != null)
     {
         if (strikePricePerUnitNode.Attributes["href"] != null || strikePricePerUnitNode.Attributes["id"] != null) 
         {
             if (strikePricePerUnitNode.Attributes["id"] != null) 
             {
                 strikePricePerUnitIDRef_ = strikePricePerUnitNode.Attributes["id"].Value;
                 NonNegativeMoney ob = new NonNegativeMoney(strikePricePerUnitNode);
                 IDManager.SetID(strikePricePerUnitIDRef_, ob);
             }
             else if (strikePricePerUnitNode.Attributes["href"] != null)
             {
                 strikePricePerUnitIDRef_ = strikePricePerUnitNode.Attributes["href"].Value;
             }
             else
             {
                 strikePricePerUnit_ = new NonNegativeMoney(strikePricePerUnitNode);
             }
         }
         else
         {
             strikePricePerUnit_ = new NonNegativeMoney(strikePricePerUnitNode);
         }
     }
     
 
     XmlNode strikePricePerUnitScheduleNode = xmlNode.SelectSingleNode("strikePricePerUnitSchedule");
     
     if (strikePricePerUnitScheduleNode != null)
     {
         if (strikePricePerUnitScheduleNode.Attributes["href"] != null || strikePricePerUnitScheduleNode.Attributes["id"] != null) 
         {
             if (strikePricePerUnitScheduleNode.Attributes["id"] != null) 
             {
                 strikePricePerUnitScheduleIDRef_ = strikePricePerUnitScheduleNode.Attributes["id"].Value;
                 CommodityStrikeSchedule ob = new CommodityStrikeSchedule(strikePricePerUnitScheduleNode);
                 IDManager.SetID(strikePricePerUnitScheduleIDRef_, ob);
             }
             else if (strikePricePerUnitScheduleNode.Attributes["href"] != null)
             {
                 strikePricePerUnitScheduleIDRef_ = strikePricePerUnitScheduleNode.Attributes["href"].Value;
             }
             else
             {
                 strikePricePerUnitSchedule_ = new CommodityStrikeSchedule(strikePricePerUnitScheduleNode);
             }
         }
         else
         {
             strikePricePerUnitSchedule_ = new CommodityStrikeSchedule(strikePricePerUnitScheduleNode);
         }
     }
     
 
     XmlNode floatingStrikePricePerUnitNode = xmlNode.SelectSingleNode("floatingStrikePricePerUnit");
     
     if (floatingStrikePricePerUnitNode != null)
     {
         if (floatingStrikePricePerUnitNode.Attributes["href"] != null || floatingStrikePricePerUnitNode.Attributes["id"] != null) 
         {
             if (floatingStrikePricePerUnitNode.Attributes["id"] != null) 
             {
                 floatingStrikePricePerUnitIDRef_ = floatingStrikePricePerUnitNode.Attributes["id"].Value;
                 FloatingStrikePrice ob = new FloatingStrikePrice(floatingStrikePricePerUnitNode);
                 IDManager.SetID(floatingStrikePricePerUnitIDRef_, ob);
             }
             else if (floatingStrikePricePerUnitNode.Attributes["href"] != null)
             {
                 floatingStrikePricePerUnitIDRef_ = floatingStrikePricePerUnitNode.Attributes["href"].Value;
             }
             else
             {
                 floatingStrikePricePerUnit_ = new FloatingStrikePrice(floatingStrikePricePerUnitNode);
             }
         }
         else
         {
             floatingStrikePricePerUnit_ = new FloatingStrikePrice(floatingStrikePricePerUnitNode);
         }
     }
     
 
     XmlNode floatingStrikePricePerUnitScheduleNode = xmlNode.SelectSingleNode("floatingStrikePricePerUnitSchedule");
     
     if (floatingStrikePricePerUnitScheduleNode != null)
     {
         if (floatingStrikePricePerUnitScheduleNode.Attributes["href"] != null || floatingStrikePricePerUnitScheduleNode.Attributes["id"] != null) 
         {
             if (floatingStrikePricePerUnitScheduleNode.Attributes["id"] != null) 
             {
                 floatingStrikePricePerUnitScheduleIDRef_ = floatingStrikePricePerUnitScheduleNode.Attributes["id"].Value;
                 CommodityCalculationPeriodsSchedule ob = new CommodityCalculationPeriodsSchedule(floatingStrikePricePerUnitScheduleNode);
                 IDManager.SetID(floatingStrikePricePerUnitScheduleIDRef_, ob);
             }
             else if (floatingStrikePricePerUnitScheduleNode.Attributes["href"] != null)
             {
                 floatingStrikePricePerUnitScheduleIDRef_ = floatingStrikePricePerUnitScheduleNode.Attributes["href"].Value;
             }
             else
             {
                 floatingStrikePricePerUnitSchedule_ = new CommodityCalculationPeriodsSchedule(floatingStrikePricePerUnitScheduleNode);
             }
         }
         else
         {
             floatingStrikePricePerUnitSchedule_ = new CommodityCalculationPeriodsSchedule(floatingStrikePricePerUnitScheduleNode);
         }
     }
     
 
     XmlNode commoditySwapNode = xmlNode.SelectSingleNode("commoditySwap");
     
     if (commoditySwapNode != null)
     {
         if (commoditySwapNode.Attributes["href"] != null || commoditySwapNode.Attributes["id"] != null) 
         {
             if (commoditySwapNode.Attributes["id"] != null) 
             {
                 commoditySwapIDRef_ = commoditySwapNode.Attributes["id"].Value;
                 CommoditySwap ob = new CommoditySwap(commoditySwapNode);
                 IDManager.SetID(commoditySwapIDRef_, ob);
             }
             else if (commoditySwapNode.Attributes["href"] != null)
             {
                 commoditySwapIDRef_ = commoditySwapNode.Attributes["href"].Value;
             }
             else
             {
                 commoditySwap_ = new CommoditySwap(commoditySwapNode);
             }
         }
         else
         {
             commoditySwap_ = new CommoditySwap(commoditySwapNode);
         }
     }
     
 
     XmlNode commodityForwardNode = xmlNode.SelectSingleNode("commodityForward");
     
     if (commodityForwardNode != null)
     {
         if (commodityForwardNode.Attributes["href"] != null || commodityForwardNode.Attributes["id"] != null) 
         {
             if (commodityForwardNode.Attributes["id"] != null) 
             {
                 commodityForwardIDRef_ = commodityForwardNode.Attributes["id"].Value;
                 CommodityForward ob = new CommodityForward(commodityForwardNode);
                 IDManager.SetID(commodityForwardIDRef_, ob);
             }
             else if (commodityForwardNode.Attributes["href"] != null)
             {
                 commodityForwardIDRef_ = commodityForwardNode.Attributes["href"].Value;
             }
             else
             {
                 commodityForward_ = new CommodityForward(commodityForwardNode);
             }
         }
         else
         {
             commodityForward_ = new CommodityForward(commodityForwardNode);
         }
     }
     
 
     XmlNode physicalExerciseNode = xmlNode.SelectSingleNode("physicalExercise");
     
     if (physicalExerciseNode != null)
     {
         if (physicalExerciseNode.Attributes["href"] != null || physicalExerciseNode.Attributes["id"] != null) 
         {
             if (physicalExerciseNode.Attributes["id"] != null) 
             {
                 physicalExerciseIDRef_ = physicalExerciseNode.Attributes["id"].Value;
                 CommodityPhysicalExercise ob = new CommodityPhysicalExercise(physicalExerciseNode);
                 IDManager.SetID(physicalExerciseIDRef_, ob);
             }
             else if (physicalExerciseNode.Attributes["href"] != null)
             {
                 physicalExerciseIDRef_ = physicalExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
             }
         }
         else
         {
             physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
         }
     }
     
 
     XmlNode weatherCalculationPeriodsNode = xmlNode.SelectSingleNode("weatherCalculationPeriods");
     
     if (weatherCalculationPeriodsNode != null)
     {
         if (weatherCalculationPeriodsNode.Attributes["href"] != null || weatherCalculationPeriodsNode.Attributes["id"] != null) 
         {
             if (weatherCalculationPeriodsNode.Attributes["id"] != null) 
             {
                 weatherCalculationPeriodsIDRef_ = weatherCalculationPeriodsNode.Attributes["id"].Value;
                 WeatherCalculationPeriods ob = new WeatherCalculationPeriods(weatherCalculationPeriodsNode);
                 IDManager.SetID(weatherCalculationPeriodsIDRef_, ob);
             }
             else if (weatherCalculationPeriodsNode.Attributes["href"] != null)
             {
                 weatherCalculationPeriodsIDRef_ = weatherCalculationPeriodsNode.Attributes["href"].Value;
             }
             else
             {
                 weatherCalculationPeriods_ = new WeatherCalculationPeriods(weatherCalculationPeriodsNode);
             }
         }
         else
         {
             weatherCalculationPeriods_ = new WeatherCalculationPeriods(weatherCalculationPeriodsNode);
         }
     }
     
 
     XmlNode weatherCalculationPeriodsReferenceNode = xmlNode.SelectSingleNode("weatherCalculationPeriodsReference");
     
     if (weatherCalculationPeriodsReferenceNode != null)
     {
         if (weatherCalculationPeriodsReferenceNode.Attributes["href"] != null || weatherCalculationPeriodsReferenceNode.Attributes["id"] != null) 
         {
             if (weatherCalculationPeriodsReferenceNode.Attributes["id"] != null) 
             {
                 weatherCalculationPeriodsReferenceIDRef_ = weatherCalculationPeriodsReferenceNode.Attributes["id"].Value;
                 CalculationPeriodsReference ob = new CalculationPeriodsReference(weatherCalculationPeriodsReferenceNode);
                 IDManager.SetID(weatherCalculationPeriodsReferenceIDRef_, ob);
             }
             else if (weatherCalculationPeriodsReferenceNode.Attributes["href"] != null)
             {
                 weatherCalculationPeriodsReferenceIDRef_ = weatherCalculationPeriodsReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 weatherCalculationPeriodsReference_ = new CalculationPeriodsReference(weatherCalculationPeriodsReferenceNode);
             }
         }
         else
         {
             weatherCalculationPeriodsReference_ = new CalculationPeriodsReference(weatherCalculationPeriodsReferenceNode);
         }
     }
     
 
     XmlNode weatherNotionalAmountNode = xmlNode.SelectSingleNode("weatherNotionalAmount");
     
     if (weatherNotionalAmountNode != null)
     {
         if (weatherNotionalAmountNode.Attributes["href"] != null || weatherNotionalAmountNode.Attributes["id"] != null) 
         {
             if (weatherNotionalAmountNode.Attributes["id"] != null) 
             {
                 weatherNotionalAmountIDRef_ = weatherNotionalAmountNode.Attributes["id"].Value;
                 NonNegativeMoney ob = new NonNegativeMoney(weatherNotionalAmountNode);
                 IDManager.SetID(weatherNotionalAmountIDRef_, ob);
             }
             else if (weatherNotionalAmountNode.Attributes["href"] != null)
             {
                 weatherNotionalAmountIDRef_ = weatherNotionalAmountNode.Attributes["href"].Value;
             }
             else
             {
                 weatherNotionalAmount_ = new NonNegativeMoney(weatherNotionalAmountNode);
             }
         }
         else
         {
             weatherNotionalAmount_ = new NonNegativeMoney(weatherNotionalAmountNode);
         }
     }
     
 
     XmlNode weatherIndexStrikeLevelNode = xmlNode.SelectSingleNode("weatherIndexStrikeLevel");
     
     if (weatherIndexStrikeLevelNode != null)
     {
         if (weatherIndexStrikeLevelNode.Attributes["href"] != null || weatherIndexStrikeLevelNode.Attributes["id"] != null) 
         {
             if (weatherIndexStrikeLevelNode.Attributes["id"] != null) 
             {
                 weatherIndexStrikeLevelIDRef_ = weatherIndexStrikeLevelNode.Attributes["id"].Value;
                 WeatherIndex ob = new WeatherIndex(weatherIndexStrikeLevelNode);
                 IDManager.SetID(weatherIndexStrikeLevelIDRef_, ob);
             }
             else if (weatherIndexStrikeLevelNode.Attributes["href"] != null)
             {
                 weatherIndexStrikeLevelIDRef_ = weatherIndexStrikeLevelNode.Attributes["href"].Value;
             }
             else
             {
                 weatherIndexStrikeLevel_ = new WeatherIndex(weatherIndexStrikeLevelNode);
             }
         }
         else
         {
             weatherIndexStrikeLevel_ = new WeatherIndex(weatherIndexStrikeLevelNode);
         }
     }
     
 
     XmlNode calculationNode = xmlNode.SelectSingleNode("calculation");
     
     if (calculationNode != null)
     {
         if (calculationNode.Attributes["href"] != null || calculationNode.Attributes["id"] != null) 
         {
             if (calculationNode.Attributes["id"] != null) 
             {
                 calculationIDRef_ = calculationNode.Attributes["id"].Value;
                 WeatherLegCalculation ob = new WeatherLegCalculation(calculationNode);
                 IDManager.SetID(calculationIDRef_, ob);
             }
             else if (calculationNode.Attributes["href"] != null)
             {
                 calculationIDRef_ = calculationNode.Attributes["href"].Value;
             }
             else
             {
                 calculation_ = new WeatherLegCalculation(calculationNode);
             }
         }
         else
         {
             calculation_ = new WeatherLegCalculation(calculationNode);
         }
     }
     
 
     XmlNode weatherIndexDataNode = xmlNode.SelectSingleNode("weatherIndexData");
     
     if (weatherIndexDataNode != null)
     {
         if (weatherIndexDataNode.Attributes["href"] != null || weatherIndexDataNode.Attributes["id"] != null) 
         {
             if (weatherIndexDataNode.Attributes["id"] != null) 
             {
                 weatherIndexDataIDRef_ = weatherIndexDataNode.Attributes["id"].Value;
                 WeatherIndexData ob = new WeatherIndexData(weatherIndexDataNode);
                 IDManager.SetID(weatherIndexDataIDRef_, ob);
             }
             else if (weatherIndexDataNode.Attributes["href"] != null)
             {
                 weatherIndexDataIDRef_ = weatherIndexDataNode.Attributes["href"].Value;
             }
             else
             {
                 weatherIndexData_ = new WeatherIndexData(weatherIndexDataNode);
             }
         }
         else
         {
             weatherIndexData_ = new WeatherIndexData(weatherIndexDataNode);
         }
     }
     
 
     XmlNodeList premiumNodeList = xmlNode.SelectNodes("premium");
     
     if (premiumNodeList != null)
     {
         this.premium_ = new List<CommodityPremium>();
         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 CommodityPremium(item));
                     IDManager.SetID(premiumIDRef_, premium_[premium_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     premiumIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 premium_.Add(new CommodityPremium(item));
                 }
             }
             else
             {
                 premium_.Add(new CommodityPremium(item));
             }
         }
     }
     
 
     XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");
     
     if (commonPricingNode != null)
     {
         if (commonPricingNode.Attributes["href"] != null || commonPricingNode.Attributes["id"] != null) 
         {
             if (commonPricingNode.Attributes["id"] != null) 
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(commonPricingNode);
                 IDManager.SetID(commonPricingIDRef_, ob);
             }
             else if (commonPricingNode.Attributes["href"] != null)
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["href"].Value;
             }
             else
             {
                 commonPricing_ = new XsdTypeBoolean(commonPricingNode);
             }
         }
         else
         {
             commonPricing_ = new XsdTypeBoolean(commonPricingNode);
         }
     }
     
 
     XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");
     
     if (marketDisruptionNode != null)
     {
         if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null) 
         {
             if (marketDisruptionNode.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                 CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                 IDManager.SetID(marketDisruptionIDRef_, ob);
             }
             else if (marketDisruptionNode.Attributes["href"] != null)
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
             }
         }
         else
         {
             marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
         }
     }
     
 
     XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");
     
     if (settlementDisruptionNode != null)
     {
         if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null) 
         {
             if (settlementDisruptionNode.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                 CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                 IDManager.SetID(settlementDisruptionIDRef_, ob);
             }
             else if (settlementDisruptionNode.Attributes["href"] != null)
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
             }
         }
         else
         {
             settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
         }
     }
     
 
     XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");
     
     if (roundingNode != null)
     {
         if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) 
         {
             if (roundingNode.Attributes["id"] != null) 
             {
                 roundingIDRef_ = roundingNode.Attributes["id"].Value;
                 Rounding ob = new Rounding(roundingNode);
                 IDManager.SetID(roundingIDRef_, ob);
             }
             else if (roundingNode.Attributes["href"] != null)
             {
                 roundingIDRef_ = roundingNode.Attributes["href"].Value;
             }
             else
             {
                 rounding_ = new Rounding(roundingNode);
             }
         }
         else
         {
             rounding_ = new Rounding(roundingNode);
         }
     }
     
 
 }
        public CommoditySwaptionUnderlying(XmlNode 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 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;
                        AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(terminationDateNode);
                        IDManager.SetID(terminationDateIDRef_, ob);
                    }
                    else if (terminationDateNode.Attributes["href"] != null)
                    {
                        terminationDateIDRef_ = terminationDateNode.Attributes["href"].Value;
                    }
                    else
                    {
                        terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
                    }
                }
                else
                {
                    terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
                }
            }


            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;
                        IdentifiedCurrency ob = new IdentifiedCurrency(settlementCurrencyNode);
                        IDManager.SetID(settlementCurrencyIDRef_, ob);
                    }
                    else if (settlementCurrencyNode.Attributes["href"] != null)
                    {
                        settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
                    }
                }
                else
                {
                    settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
                }
            }


            XmlNode commoditySwapLegNode = xmlNode.SelectSingleNode("commoditySwapLeg");

            if (commoditySwapLegNode != null)
            {
                if (commoditySwapLegNode.Attributes["href"] != null || commoditySwapLegNode.Attributes["id"] != null)
                {
                    if (commoditySwapLegNode.Attributes["id"] != null)
                    {
                        commoditySwapLegIDRef_ = commoditySwapLegNode.Attributes["id"].Value;
                        CommoditySwapLeg ob = new CommoditySwapLeg(commoditySwapLegNode);
                        IDManager.SetID(commoditySwapLegIDRef_, ob);
                    }
                    else if (commoditySwapLegNode.Attributes["href"] != null)
                    {
                        commoditySwapLegIDRef_ = commoditySwapLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        commoditySwapLeg_ = new CommoditySwapLeg(commoditySwapLegNode);
                    }
                }
                else
                {
                    commoditySwapLeg_ = new CommoditySwapLeg(commoditySwapLegNode);
                }
            }


            XmlNode coalPhysicalLegNode = xmlNode.SelectSingleNode("coalPhysicalLeg");

            if (coalPhysicalLegNode != null)
            {
                if (coalPhysicalLegNode.Attributes["href"] != null || coalPhysicalLegNode.Attributes["id"] != null)
                {
                    if (coalPhysicalLegNode.Attributes["id"] != null)
                    {
                        coalPhysicalLegIDRef_ = coalPhysicalLegNode.Attributes["id"].Value;
                        CoalPhysicalLeg ob = new CoalPhysicalLeg(coalPhysicalLegNode);
                        IDManager.SetID(coalPhysicalLegIDRef_, ob);
                    }
                    else if (coalPhysicalLegNode.Attributes["href"] != null)
                    {
                        coalPhysicalLegIDRef_ = coalPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        coalPhysicalLeg_ = new CoalPhysicalLeg(coalPhysicalLegNode);
                    }
                }
                else
                {
                    coalPhysicalLeg_ = new CoalPhysicalLeg(coalPhysicalLegNode);
                }
            }


            XmlNode electricityPhysicalLegNode = xmlNode.SelectSingleNode("electricityPhysicalLeg");

            if (electricityPhysicalLegNode != null)
            {
                if (electricityPhysicalLegNode.Attributes["href"] != null || electricityPhysicalLegNode.Attributes["id"] != null)
                {
                    if (electricityPhysicalLegNode.Attributes["id"] != null)
                    {
                        electricityPhysicalLegIDRef_ = electricityPhysicalLegNode.Attributes["id"].Value;
                        ElectricityPhysicalLeg ob = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
                        IDManager.SetID(electricityPhysicalLegIDRef_, ob);
                    }
                    else if (electricityPhysicalLegNode.Attributes["href"] != null)
                    {
                        electricityPhysicalLegIDRef_ = electricityPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        electricityPhysicalLeg_ = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
                    }
                }
                else
                {
                    electricityPhysicalLeg_ = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
                }
            }


            XmlNode environmentalPhysicalLegNode = xmlNode.SelectSingleNode("environmentalPhysicalLeg");

            if (environmentalPhysicalLegNode != null)
            {
                if (environmentalPhysicalLegNode.Attributes["href"] != null || environmentalPhysicalLegNode.Attributes["id"] != null)
                {
                    if (environmentalPhysicalLegNode.Attributes["id"] != null)
                    {
                        environmentalPhysicalLegIDRef_ = environmentalPhysicalLegNode.Attributes["id"].Value;
                        EnvironmentalPhysicalLeg ob = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
                        IDManager.SetID(environmentalPhysicalLegIDRef_, ob);
                    }
                    else if (environmentalPhysicalLegNode.Attributes["href"] != null)
                    {
                        environmentalPhysicalLegIDRef_ = environmentalPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        environmentalPhysicalLeg_ = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
                    }
                }
                else
                {
                    environmentalPhysicalLeg_ = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
                }
            }


            XmlNode fixedLegNode = xmlNode.SelectSingleNode("fixedLeg");

            if (fixedLegNode != null)
            {
                if (fixedLegNode.Attributes["href"] != null || fixedLegNode.Attributes["id"] != null)
                {
                    if (fixedLegNode.Attributes["id"] != null)
                    {
                        fixedLegIDRef_ = fixedLegNode.Attributes["id"].Value;
                        FixedPriceLeg ob = new FixedPriceLeg(fixedLegNode);
                        IDManager.SetID(fixedLegIDRef_, ob);
                    }
                    else if (fixedLegNode.Attributes["href"] != null)
                    {
                        fixedLegIDRef_ = fixedLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fixedLeg_ = new FixedPriceLeg(fixedLegNode);
                    }
                }
                else
                {
                    fixedLeg_ = new FixedPriceLeg(fixedLegNode);
                }
            }


            XmlNode floatingLegNode = xmlNode.SelectSingleNode("floatingLeg");

            if (floatingLegNode != null)
            {
                if (floatingLegNode.Attributes["href"] != null || floatingLegNode.Attributes["id"] != null)
                {
                    if (floatingLegNode.Attributes["id"] != null)
                    {
                        floatingLegIDRef_ = floatingLegNode.Attributes["id"].Value;
                        FloatingPriceLeg ob = new FloatingPriceLeg(floatingLegNode);
                        IDManager.SetID(floatingLegIDRef_, ob);
                    }
                    else if (floatingLegNode.Attributes["href"] != null)
                    {
                        floatingLegIDRef_ = floatingLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        floatingLeg_ = new FloatingPriceLeg(floatingLegNode);
                    }
                }
                else
                {
                    floatingLeg_ = new FloatingPriceLeg(floatingLegNode);
                }
            }


            XmlNode gasPhysicalLegNode = xmlNode.SelectSingleNode("gasPhysicalLeg");

            if (gasPhysicalLegNode != null)
            {
                if (gasPhysicalLegNode.Attributes["href"] != null || gasPhysicalLegNode.Attributes["id"] != null)
                {
                    if (gasPhysicalLegNode.Attributes["id"] != null)
                    {
                        gasPhysicalLegIDRef_ = gasPhysicalLegNode.Attributes["id"].Value;
                        GasPhysicalLeg ob = new GasPhysicalLeg(gasPhysicalLegNode);
                        IDManager.SetID(gasPhysicalLegIDRef_, ob);
                    }
                    else if (gasPhysicalLegNode.Attributes["href"] != null)
                    {
                        gasPhysicalLegIDRef_ = gasPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        gasPhysicalLeg_ = new GasPhysicalLeg(gasPhysicalLegNode);
                    }
                }
                else
                {
                    gasPhysicalLeg_ = new GasPhysicalLeg(gasPhysicalLegNode);
                }
            }


            XmlNode oilPhysicalLegNode = xmlNode.SelectSingleNode("oilPhysicalLeg");

            if (oilPhysicalLegNode != null)
            {
                if (oilPhysicalLegNode.Attributes["href"] != null || oilPhysicalLegNode.Attributes["id"] != null)
                {
                    if (oilPhysicalLegNode.Attributes["id"] != null)
                    {
                        oilPhysicalLegIDRef_ = oilPhysicalLegNode.Attributes["id"].Value;
                        OilPhysicalLeg ob = new OilPhysicalLeg(oilPhysicalLegNode);
                        IDManager.SetID(oilPhysicalLegIDRef_, ob);
                    }
                    else if (oilPhysicalLegNode.Attributes["href"] != null)
                    {
                        oilPhysicalLegIDRef_ = oilPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        oilPhysicalLeg_ = new OilPhysicalLeg(oilPhysicalLegNode);
                    }
                }
                else
                {
                    oilPhysicalLeg_ = new OilPhysicalLeg(oilPhysicalLegNode);
                }
            }


            XmlNodeList weatherLegNodeList = xmlNode.SelectNodes("weatherLeg");

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


            XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");

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


            XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");

            if (marketDisruptionNode != null)
            {
                if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null)
                {
                    if (marketDisruptionNode.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                        CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                        IDManager.SetID(marketDisruptionIDRef_, ob);
                    }
                    else if (marketDisruptionNode.Attributes["href"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                    }
                }
                else
                {
                    marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                }
            }


            XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");

            if (settlementDisruptionNode != null)
            {
                if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null)
                {
                    if (settlementDisruptionNode.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                        CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                        IDManager.SetID(settlementDisruptionIDRef_, ob);
                    }
                    else if (settlementDisruptionNode.Attributes["href"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                    }
                }
                else
                {
                    settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                }
            }


            XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");

            if (roundingNode != null)
            {
                if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null)
                {
                    if (roundingNode.Attributes["id"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["id"].Value;
                        Rounding ob = new Rounding(roundingNode);
                        IDManager.SetID(roundingIDRef_, ob);
                    }
                    else if (roundingNode.Attributes["href"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["href"].Value;
                    }
                    else
                    {
                        rounding_ = new Rounding(roundingNode);
                    }
                }
                else
                {
                    rounding_ = new Rounding(roundingNode);
                }
            }
        }
 public CommodityOption(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 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;
                 PutCallEnum ob = PutCallEnum();
                 IDManager.SetID(optionTypeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 optionTypeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 optionType = new PutCallEnum(item);
             }
         }
     }
     
 
     XmlNodeList commodityNodeList = xmlNode.SelectNodes("commodity");
     if (commodityNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commodityNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commodityIDRef = item.Attributes["id"].Name;
                 Commodity ob = Commodity();
                 IDManager.SetID(commodityIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commodityIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commodity = new Commodity(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;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(effectiveDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 effectiveDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 effectiveDate = new AdjustableOrRelativeDate(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;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(terminationDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 terminationDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 terminationDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList calculationPeriodsScheduleNodeList = xmlNode.SelectNodes("calculationPeriodsSchedule");
     if (calculationPeriodsScheduleNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationPeriodsScheduleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationPeriodsScheduleIDRef = item.Attributes["id"].Name;
                 CommodityCalculationPeriodsSchedule ob = CommodityCalculationPeriodsSchedule();
                 IDManager.SetID(calculationPeriodsScheduleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationPeriodsScheduleIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationPeriodsSchedule = new CommodityCalculationPeriodsSchedule(item);
             }
         }
     }
     
 
     XmlNodeList calculationPeriodsNodeList = xmlNode.SelectNodes("calculationPeriods");
     if (calculationPeriodsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationPeriodsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationPeriodsIDRef = item.Attributes["id"].Name;
                 AdjustableDates ob = AdjustableDates();
                 IDManager.SetID(calculationPeriodsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationPeriodsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationPeriods = new AdjustableDates(item);
             }
         }
     }
     
 
     XmlNodeList pricingDatesNodeList = xmlNode.SelectNodes("pricingDates");
     if (pricingDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in pricingDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 pricingDatesIDRef = item.Attributes["id"].Name;
                 CommodityPricingDates ob = CommodityPricingDates();
                 IDManager.SetID(pricingDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 pricingDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 pricingDates = new CommodityPricingDates(item);
             }
         }
     }
     
 
     XmlNodeList averagingMethodNodeList = xmlNode.SelectNodes("averagingMethod");
     if (averagingMethodNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in averagingMethodNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 averagingMethodIDRef = item.Attributes["id"].Name;
                 AveragingMethodEnum ob = AveragingMethodEnum();
                 IDManager.SetID(averagingMethodIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 averagingMethodIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 averagingMethod = new AveragingMethodEnum(item);
             }
         }
     }
     
 
     XmlNodeList notionalQuantityScheduleNodeList = xmlNode.SelectNodes("notionalQuantitySchedule");
     if (notionalQuantityScheduleNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in notionalQuantityScheduleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 notionalQuantityScheduleIDRef = item.Attributes["id"].Name;
                 CommodityNotionalQuantitySchedule ob = CommodityNotionalQuantitySchedule();
                 IDManager.SetID(notionalQuantityScheduleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 notionalQuantityScheduleIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 notionalQuantitySchedule = new CommodityNotionalQuantitySchedule(item);
             }
         }
     }
     
 
     XmlNodeList notionalQuantityNodeList = xmlNode.SelectNodes("notionalQuantity");
     if (notionalQuantityNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in notionalQuantityNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 notionalQuantityIDRef = item.Attributes["id"].Name;
                 CommodityNotionalQuantity ob = CommodityNotionalQuantity();
                 IDManager.SetID(notionalQuantityIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 notionalQuantityIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 notionalQuantity = new CommodityNotionalQuantity(item);
             }
         }
     }
     
 
     XmlNodeList settlementPeriodsNotionalQuantityNodeList = xmlNode.SelectNodes("settlementPeriodsNotionalQuantity");
     
     foreach (XmlNode item in settlementPeriodsNotionalQuantityNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementPeriodsNotionalQuantityIDRef = item.Attributes["id"].Name;
                 List<CommoditySettlementPeriodsNotionalQuantity> ob = new List<CommoditySettlementPeriodsNotionalQuantity>();
                 ob.Add(new CommoditySettlementPeriodsNotionalQuantity(item));
                 IDManager.SetID(settlementPeriodsNotionalQuantityIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementPeriodsNotionalQuantityIDRef = item.Attributes["href"].Name;
             }
             else
             {
             settlementPeriodsNotionalQuantity.Add(new CommoditySettlementPeriodsNotionalQuantity(item));
             }
         }
     }
     
 
     XmlNodeList totalNotionalQuantityNodeList = xmlNode.SelectNodes("totalNotionalQuantity");
     if (totalNotionalQuantityNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in totalNotionalQuantityNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 totalNotionalQuantityIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(totalNotionalQuantityIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 totalNotionalQuantityIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 totalNotionalQuantity = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList quantityReferenceNodeList = xmlNode.SelectNodes("quantityReference");
     if (quantityReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in quantityReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 quantityReferenceIDRef = item.Attributes["id"].Name;
                 QuantityReference ob = QuantityReference();
                 IDManager.SetID(quantityReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 quantityReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 quantityReference = new QuantityReference(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;
                 CommodityExercise ob = CommodityExercise();
                 IDManager.SetID(exerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 exerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 exercise = new CommodityExercise(item);
             }
         }
     }
     
 
     XmlNodeList strikePricePerUnitNodeList = xmlNode.SelectNodes("strikePricePerUnit");
     if (strikePricePerUnitNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in strikePricePerUnitNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 strikePricePerUnitIDRef = item.Attributes["id"].Name;
                 NonNegativeMoney ob = NonNegativeMoney();
                 IDManager.SetID(strikePricePerUnitIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 strikePricePerUnitIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 strikePricePerUnit = new NonNegativeMoney(item);
             }
         }
     }
     
 
     XmlNodeList strikePricePerUnitScheduleNodeList = xmlNode.SelectNodes("strikePricePerUnitSchedule");
     if (strikePricePerUnitScheduleNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in strikePricePerUnitScheduleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 strikePricePerUnitScheduleIDRef = item.Attributes["id"].Name;
                 CommodityStrikeSchedule ob = CommodityStrikeSchedule();
                 IDManager.SetID(strikePricePerUnitScheduleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 strikePricePerUnitScheduleIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 strikePricePerUnitSchedule = new CommodityStrikeSchedule(item);
             }
         }
     }
     
 
     XmlNodeList floatingStrikePricePerUnitNodeList = xmlNode.SelectNodes("floatingStrikePricePerUnit");
     if (floatingStrikePricePerUnitNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in floatingStrikePricePerUnitNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 floatingStrikePricePerUnitIDRef = item.Attributes["id"].Name;
                 FloatingStrikePrice ob = FloatingStrikePrice();
                 IDManager.SetID(floatingStrikePricePerUnitIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 floatingStrikePricePerUnitIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 floatingStrikePricePerUnit = new FloatingStrikePrice(item);
             }
         }
     }
     
 
     XmlNodeList floatingStrikePricePerUnitScheduleNodeList = xmlNode.SelectNodes("floatingStrikePricePerUnitSchedule");
     if (floatingStrikePricePerUnitScheduleNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in floatingStrikePricePerUnitScheduleNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 floatingStrikePricePerUnitScheduleIDRef = item.Attributes["id"].Name;
                 CommodityCalculationPeriodsSchedule ob = CommodityCalculationPeriodsSchedule();
                 IDManager.SetID(floatingStrikePricePerUnitScheduleIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 floatingStrikePricePerUnitScheduleIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 floatingStrikePricePerUnitSchedule = new CommodityCalculationPeriodsSchedule(item);
             }
         }
     }
     
 
     XmlNodeList commoditySwapNodeList = xmlNode.SelectNodes("commoditySwap");
     if (commoditySwapNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commoditySwapNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commoditySwapIDRef = item.Attributes["id"].Name;
                 CommoditySwap ob = CommoditySwap();
                 IDManager.SetID(commoditySwapIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commoditySwapIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commoditySwap = new CommoditySwap(item);
             }
         }
     }
     
 
     XmlNodeList commodityForwardNodeList = xmlNode.SelectNodes("commodityForward");
     if (commodityForwardNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commodityForwardNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commodityForwardIDRef = item.Attributes["id"].Name;
                 CommodityForward ob = CommodityForward();
                 IDManager.SetID(commodityForwardIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commodityForwardIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commodityForward = new CommodityForward(item);
             }
         }
     }
     
 
     XmlNodeList physicalExerciseNodeList = xmlNode.SelectNodes("physicalExercise");
     if (physicalExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in physicalExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 physicalExerciseIDRef = item.Attributes["id"].Name;
                 CommodityPhysicalExercise ob = CommodityPhysicalExercise();
                 IDManager.SetID(physicalExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 physicalExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 physicalExercise = new CommodityPhysicalExercise(item);
             }
         }
     }
     
 
     XmlNodeList weatherCalculationPeriodsNodeList = xmlNode.SelectNodes("weatherCalculationPeriods");
     if (weatherCalculationPeriodsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in weatherCalculationPeriodsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherCalculationPeriodsIDRef = item.Attributes["id"].Name;
                 WeatherCalculationPeriods ob = WeatherCalculationPeriods();
                 IDManager.SetID(weatherCalculationPeriodsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherCalculationPeriodsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 weatherCalculationPeriods = new WeatherCalculationPeriods(item);
             }
         }
     }
     
 
     XmlNodeList weatherCalculationPeriodsReferenceNodeList = xmlNode.SelectNodes("weatherCalculationPeriodsReference");
     if (weatherCalculationPeriodsReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in weatherCalculationPeriodsReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherCalculationPeriodsReferenceIDRef = item.Attributes["id"].Name;
                 CalculationPeriodsReference ob = CalculationPeriodsReference();
                 IDManager.SetID(weatherCalculationPeriodsReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherCalculationPeriodsReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 weatherCalculationPeriodsReference = new CalculationPeriodsReference(item);
             }
         }
     }
     
 
     XmlNodeList weatherNotionalAmountNodeList = xmlNode.SelectNodes("weatherNotionalAmount");
     if (weatherNotionalAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in weatherNotionalAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherNotionalAmountIDRef = item.Attributes["id"].Name;
                 NonNegativeMoney ob = NonNegativeMoney();
                 IDManager.SetID(weatherNotionalAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherNotionalAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 weatherNotionalAmount = new NonNegativeMoney(item);
             }
         }
     }
     
 
     XmlNodeList weatherIndexStrikeLevelNodeList = xmlNode.SelectNodes("weatherIndexStrikeLevel");
     if (weatherIndexStrikeLevelNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in weatherIndexStrikeLevelNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherIndexStrikeLevelIDRef = item.Attributes["id"].Name;
                 WeatherIndex ob = WeatherIndex();
                 IDManager.SetID(weatherIndexStrikeLevelIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherIndexStrikeLevelIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 weatherIndexStrikeLevel = new WeatherIndex(item);
             }
         }
     }
     
 
     XmlNodeList calculationNodeList = xmlNode.SelectNodes("calculation");
     if (calculationNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationIDRef = item.Attributes["id"].Name;
                 WeatherLegCalculation ob = WeatherLegCalculation();
                 IDManager.SetID(calculationIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculation = new WeatherLegCalculation(item);
             }
         }
     }
     
 
     XmlNodeList weatherIndexDataNodeList = xmlNode.SelectNodes("weatherIndexData");
     if (weatherIndexDataNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in weatherIndexDataNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherIndexDataIDRef = item.Attributes["id"].Name;
                 WeatherIndexData ob = WeatherIndexData();
                 IDManager.SetID(weatherIndexDataIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherIndexDataIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 weatherIndexData = new WeatherIndexData(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<CommodityPremium> ob = new List<CommodityPremium>();
                 ob.Add(new CommodityPremium(item));
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
             premium.Add(new CommodityPremium(item));
             }
         }
     }
     
 
     XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");
     if (commonPricingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commonPricingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commonPricingIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(commonPricingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commonPricingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commonPricing = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");
     if (marketDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in marketDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityMarketDisruption ob = CommodityMarketDisruption();
                 IDManager.SetID(marketDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 marketDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 marketDisruption = new CommodityMarketDisruption(item);
             }
         }
     }
     
 
     XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");
     if (settlementDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                 IDManager.SetID(settlementDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
             }
         }
     }
     
 
     XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");
     if (roundingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in roundingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 roundingIDRef = item.Attributes["id"].Name;
                 Rounding ob = Rounding();
                 IDManager.SetID(roundingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 roundingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rounding = new Rounding(item);
             }
         }
     }
     
 
 }
 public CommoditySwaption(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 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;
                 PutCallEnum ob = PutCallEnum();
                 IDManager.SetID(optionTypeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 optionTypeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 optionType = new PutCallEnum(item);
             }
         }
     }
     
 
     XmlNodeList commoditySwapNodeList = xmlNode.SelectNodes("commoditySwap");
     if (commoditySwapNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commoditySwapNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commoditySwapIDRef = item.Attributes["id"].Name;
                 CommoditySwaptionUnderlying ob = CommoditySwaptionUnderlying();
                 IDManager.SetID(commoditySwapIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commoditySwapIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commoditySwap = new CommoditySwaptionUnderlying(item);
             }
         }
     }
     
 
     XmlNodeList physicalExerciseNodeList = xmlNode.SelectNodes("physicalExercise");
     if (physicalExerciseNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in physicalExerciseNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 physicalExerciseIDRef = item.Attributes["id"].Name;
                 CommodityPhysicalExercise ob = CommodityPhysicalExercise();
                 IDManager.SetID(physicalExerciseIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 physicalExerciseIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 physicalExercise = new CommodityPhysicalExercise(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;
                 CommodityPremium ob = CommodityPremium();
                 IDManager.SetID(premiumIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 premiumIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 premium = new CommodityPremium(item);
             }
         }
     }
     
 
     XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");
     if (commonPricingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commonPricingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commonPricingIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(commonPricingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commonPricingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commonPricing = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");
     if (marketDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in marketDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityMarketDisruption ob = CommodityMarketDisruption();
                 IDManager.SetID(marketDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 marketDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 marketDisruption = new CommodityMarketDisruption(item);
             }
         }
     }
     
 
     XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");
     if (settlementDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                 IDManager.SetID(settlementDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
             }
         }
     }
     
 
     XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");
     if (roundingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in roundingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 roundingIDRef = item.Attributes["id"].Name;
                 Rounding ob = Rounding();
                 IDManager.SetID(roundingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 roundingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rounding = new Rounding(item);
             }
         }
     }
     
 
 }
 public CommoditySwap(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 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;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(terminationDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 terminationDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 terminationDate = new AdjustableOrRelativeDate(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;
                 IdentifiedCurrency ob = IdentifiedCurrency();
                 IDManager.SetID(settlementCurrencyIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementCurrencyIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementCurrency = new IdentifiedCurrency(item);
             }
         }
     }
     
 
     XmlNodeList commoditySwapLegNodeList = xmlNode.SelectNodes("commoditySwapLeg");
     if (commoditySwapLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commoditySwapLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commoditySwapLegIDRef = item.Attributes["id"].Name;
                 CommoditySwapLeg ob = CommoditySwapLeg();
                 IDManager.SetID(commoditySwapLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commoditySwapLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commoditySwapLeg = new CommoditySwapLeg(item);
             }
         }
     }
     
 
     XmlNodeList coalPhysicalLegNodeList = xmlNode.SelectNodes("coalPhysicalLeg");
     if (coalPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in coalPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 coalPhysicalLegIDRef = item.Attributes["id"].Name;
                 CoalPhysicalLeg ob = CoalPhysicalLeg();
                 IDManager.SetID(coalPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 coalPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 coalPhysicalLeg = new CoalPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList electricityPhysicalLegNodeList = xmlNode.SelectNodes("electricityPhysicalLeg");
     if (electricityPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in electricityPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 electricityPhysicalLegIDRef = item.Attributes["id"].Name;
                 ElectricityPhysicalLeg ob = ElectricityPhysicalLeg();
                 IDManager.SetID(electricityPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 electricityPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 electricityPhysicalLeg = new ElectricityPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList environmentalPhysicalLegNodeList = xmlNode.SelectNodes("environmentalPhysicalLeg");
     if (environmentalPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in environmentalPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 environmentalPhysicalLegIDRef = item.Attributes["id"].Name;
                 EnvironmentalPhysicalLeg ob = EnvironmentalPhysicalLeg();
                 IDManager.SetID(environmentalPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 environmentalPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 environmentalPhysicalLeg = new EnvironmentalPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList fixedLegNodeList = xmlNode.SelectNodes("fixedLeg");
     if (fixedLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fixedLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fixedLegIDRef = item.Attributes["id"].Name;
                 FixedPriceLeg ob = FixedPriceLeg();
                 IDManager.SetID(fixedLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fixedLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fixedLeg = new FixedPriceLeg(item);
             }
         }
     }
     
 
     XmlNodeList floatingLegNodeList = xmlNode.SelectNodes("floatingLeg");
     if (floatingLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in floatingLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 floatingLegIDRef = item.Attributes["id"].Name;
                 FloatingPriceLeg ob = FloatingPriceLeg();
                 IDManager.SetID(floatingLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 floatingLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 floatingLeg = new FloatingPriceLeg(item);
             }
         }
     }
     
 
     XmlNodeList gasPhysicalLegNodeList = xmlNode.SelectNodes("gasPhysicalLeg");
     if (gasPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in gasPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 gasPhysicalLegIDRef = item.Attributes["id"].Name;
                 GasPhysicalLeg ob = GasPhysicalLeg();
                 IDManager.SetID(gasPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 gasPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 gasPhysicalLeg = new GasPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList oilPhysicalLegNodeList = xmlNode.SelectNodes("oilPhysicalLeg");
     if (oilPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in oilPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 oilPhysicalLegIDRef = item.Attributes["id"].Name;
                 OilPhysicalLeg ob = OilPhysicalLeg();
                 IDManager.SetID(oilPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 oilPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 oilPhysicalLeg = new OilPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList weatherLegNodeList = xmlNode.SelectNodes("weatherLeg");
     
     foreach (XmlNode item in weatherLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 weatherLegIDRef = item.Attributes["id"].Name;
                 List<WeatherLeg> ob = new List<WeatherLeg>();
                 ob.Add(new WeatherLeg(item));
                 IDManager.SetID(weatherLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 weatherLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
             weatherLeg.Add(new WeatherLeg(item));
             }
         }
     }
     
 
     XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");
     if (commonPricingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commonPricingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commonPricingIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(commonPricingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commonPricingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commonPricing = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");
     if (marketDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in marketDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityMarketDisruption ob = CommodityMarketDisruption();
                 IDManager.SetID(marketDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 marketDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 marketDisruption = new CommodityMarketDisruption(item);
             }
         }
     }
     
 
     XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");
     if (settlementDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                 IDManager.SetID(settlementDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
             }
         }
     }
     
 
     XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");
     if (roundingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in roundingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 roundingIDRef = item.Attributes["id"].Name;
                 Rounding ob = Rounding();
                 IDManager.SetID(roundingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 roundingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rounding = new Rounding(item);
             }
         }
     }
     
 
 }
        public CommodityForward(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNode valueDateNode = xmlNode.SelectSingleNode("valueDate");

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


            XmlNode fixedLegNode = xmlNode.SelectSingleNode("fixedLeg");

            if (fixedLegNode != null)
            {
                if (fixedLegNode.Attributes["href"] != null || fixedLegNode.Attributes["id"] != null)
                {
                    if (fixedLegNode.Attributes["id"] != null)
                    {
                        fixedLegIDRef_ = fixedLegNode.Attributes["id"].Value;
                        NonPeriodicFixedPriceLeg ob = new NonPeriodicFixedPriceLeg(fixedLegNode);
                        IDManager.SetID(fixedLegIDRef_, ob);
                    }
                    else if (fixedLegNode.Attributes["href"] != null)
                    {
                        fixedLegIDRef_ = fixedLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fixedLeg_ = new NonPeriodicFixedPriceLeg(fixedLegNode);
                    }
                }
                else
                {
                    fixedLeg_ = new NonPeriodicFixedPriceLeg(fixedLegNode);
                }
            }


            XmlNode averagePriceLegNode = xmlNode.SelectSingleNode("averagePriceLeg");

            if (averagePriceLegNode != null)
            {
                if (averagePriceLegNode.Attributes["href"] != null || averagePriceLegNode.Attributes["id"] != null)
                {
                    if (averagePriceLegNode.Attributes["id"] != null)
                    {
                        averagePriceLegIDRef_ = averagePriceLegNode.Attributes["id"].Value;
                        AveragePriceLeg ob = new AveragePriceLeg(averagePriceLegNode);
                        IDManager.SetID(averagePriceLegIDRef_, ob);
                    }
                    else if (averagePriceLegNode.Attributes["href"] != null)
                    {
                        averagePriceLegIDRef_ = averagePriceLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        averagePriceLeg_ = new AveragePriceLeg(averagePriceLegNode);
                    }
                }
                else
                {
                    averagePriceLeg_ = new AveragePriceLeg(averagePriceLegNode);
                }
            }


            XmlNode commodityForwardLegNode = xmlNode.SelectSingleNode("commodityForwardLeg");

            if (commodityForwardLegNode != null)
            {
                if (commodityForwardLegNode.Attributes["href"] != null || commodityForwardLegNode.Attributes["id"] != null)
                {
                    if (commodityForwardLegNode.Attributes["id"] != null)
                    {
                        commodityForwardLegIDRef_ = commodityForwardLegNode.Attributes["id"].Value;
                        CommodityForwardLeg ob = new CommodityForwardLeg(commodityForwardLegNode);
                        IDManager.SetID(commodityForwardLegIDRef_, ob);
                    }
                    else if (commodityForwardLegNode.Attributes["href"] != null)
                    {
                        commodityForwardLegIDRef_ = commodityForwardLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        commodityForwardLeg_ = new CommodityForwardLeg(commodityForwardLegNode);
                    }
                }
                else
                {
                    commodityForwardLeg_ = new CommodityForwardLeg(commodityForwardLegNode);
                }
            }


            XmlNode bullionPhysicalLegNode = xmlNode.SelectSingleNode("bullionPhysicalLeg");

            if (bullionPhysicalLegNode != null)
            {
                if (bullionPhysicalLegNode.Attributes["href"] != null || bullionPhysicalLegNode.Attributes["id"] != null)
                {
                    if (bullionPhysicalLegNode.Attributes["id"] != null)
                    {
                        bullionPhysicalLegIDRef_ = bullionPhysicalLegNode.Attributes["id"].Value;
                        BullionPhysicalLeg ob = new BullionPhysicalLeg(bullionPhysicalLegNode);
                        IDManager.SetID(bullionPhysicalLegIDRef_, ob);
                    }
                    else if (bullionPhysicalLegNode.Attributes["href"] != null)
                    {
                        bullionPhysicalLegIDRef_ = bullionPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        bullionPhysicalLeg_ = new BullionPhysicalLeg(bullionPhysicalLegNode);
                    }
                }
                else
                {
                    bullionPhysicalLeg_ = new BullionPhysicalLeg(bullionPhysicalLegNode);
                }
            }


            XmlNode metalPhysicalLegNode = xmlNode.SelectSingleNode("metalPhysicalLeg");

            if (metalPhysicalLegNode != null)
            {
                if (metalPhysicalLegNode.Attributes["href"] != null || metalPhysicalLegNode.Attributes["id"] != null)
                {
                    if (metalPhysicalLegNode.Attributes["id"] != null)
                    {
                        metalPhysicalLegIDRef_ = metalPhysicalLegNode.Attributes["id"].Value;
                        MetalPhysicalLeg ob = new MetalPhysicalLeg(metalPhysicalLegNode);
                        IDManager.SetID(metalPhysicalLegIDRef_, ob);
                    }
                    else if (metalPhysicalLegNode.Attributes["href"] != null)
                    {
                        metalPhysicalLegIDRef_ = metalPhysicalLegNode.Attributes["href"].Value;
                    }
                    else
                    {
                        metalPhysicalLeg_ = new MetalPhysicalLeg(metalPhysicalLegNode);
                    }
                }
                else
                {
                    metalPhysicalLeg_ = new MetalPhysicalLeg(metalPhysicalLegNode);
                }
            }


            XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");

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


            XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");

            if (marketDisruptionNode != null)
            {
                if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null)
                {
                    if (marketDisruptionNode.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                        CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                        IDManager.SetID(marketDisruptionIDRef_, ob);
                    }
                    else if (marketDisruptionNode.Attributes["href"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                    }
                }
                else
                {
                    marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                }
            }


            XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");

            if (settlementDisruptionNode != null)
            {
                if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null)
                {
                    if (settlementDisruptionNode.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                        CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                        IDManager.SetID(settlementDisruptionIDRef_, ob);
                    }
                    else if (settlementDisruptionNode.Attributes["href"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                    }
                }
                else
                {
                    settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                }
            }


            XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");

            if (roundingNode != null)
            {
                if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null)
                {
                    if (roundingNode.Attributes["id"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["id"].Value;
                        Rounding ob = new Rounding(roundingNode);
                        IDManager.SetID(roundingIDRef_, ob);
                    }
                    else if (roundingNode.Attributes["href"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["href"].Value;
                    }
                    else
                    {
                        rounding_ = new Rounding(roundingNode);
                    }
                }
                else
                {
                    rounding_ = new Rounding(roundingNode);
                }
            }
        }
Пример #8
0
        public CommoditySwaption(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 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;
                        PutCallEnum ob = PutCallEnum();
                        IDManager.SetID(optionTypeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        optionTypeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        optionType = new PutCallEnum(item);
                    }
                }
            }


            XmlNodeList commoditySwapNodeList = xmlNode.SelectNodes("commoditySwap");

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

            foreach (XmlNode item in commoditySwapNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        commoditySwapIDRef = item.Attributes["id"].Name;
                        CommoditySwaptionUnderlying ob = CommoditySwaptionUnderlying();
                        IDManager.SetID(commoditySwapIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        commoditySwapIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        commoditySwap = new CommoditySwaptionUnderlying(item);
                    }
                }
            }


            XmlNodeList physicalExerciseNodeList = xmlNode.SelectNodes("physicalExercise");

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

            foreach (XmlNode item in physicalExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        physicalExerciseIDRef = item.Attributes["id"].Name;
                        CommodityPhysicalExercise ob = CommodityPhysicalExercise();
                        IDManager.SetID(physicalExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        physicalExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        physicalExercise = new CommodityPhysicalExercise(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;
                        CommodityPremium ob = CommodityPremium();
                        IDManager.SetID(premiumIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        premiumIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        premium = new CommodityPremium(item);
                    }
                }
            }


            XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");

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

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


            XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");

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

            foreach (XmlNode item in marketDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityMarketDisruption ob = CommodityMarketDisruption();
                        IDManager.SetID(marketDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        marketDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        marketDisruption = new CommodityMarketDisruption(item);
                    }
                }
            }


            XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");

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

            foreach (XmlNode item in settlementDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                        IDManager.SetID(settlementDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
                    }
                }
            }


            XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");

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

            foreach (XmlNode item in roundingNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        roundingIDRef = item.Attributes["id"].Name;
                        Rounding ob = Rounding();
                        IDManager.SetID(roundingIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        roundingIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        rounding = new Rounding(item);
                    }
                }
            }
        }
Пример #9
0
        public CommoditySwaptionUnderlying(XmlNode 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 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;
                        AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                        IDManager.SetID(terminationDateIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        terminationDateIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        terminationDate = new AdjustableOrRelativeDate(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;
                        IdentifiedCurrency ob = IdentifiedCurrency();
                        IDManager.SetID(settlementCurrencyIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementCurrencyIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementCurrency = new IdentifiedCurrency(item);
                    }
                }
            }


            XmlNodeList commoditySwapLegNodeList = xmlNode.SelectNodes("commoditySwapLeg");

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

            foreach (XmlNode item in commoditySwapLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        commoditySwapLegIDRef = item.Attributes["id"].Name;
                        CommoditySwapLeg ob = CommoditySwapLeg();
                        IDManager.SetID(commoditySwapLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        commoditySwapLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        commoditySwapLeg = new CommoditySwapLeg(item);
                    }
                }
            }


            XmlNodeList coalPhysicalLegNodeList = xmlNode.SelectNodes("coalPhysicalLeg");

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

            foreach (XmlNode item in coalPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        coalPhysicalLegIDRef = item.Attributes["id"].Name;
                        CoalPhysicalLeg ob = CoalPhysicalLeg();
                        IDManager.SetID(coalPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        coalPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        coalPhysicalLeg = new CoalPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList electricityPhysicalLegNodeList = xmlNode.SelectNodes("electricityPhysicalLeg");

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

            foreach (XmlNode item in electricityPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        electricityPhysicalLegIDRef = item.Attributes["id"].Name;
                        ElectricityPhysicalLeg ob = ElectricityPhysicalLeg();
                        IDManager.SetID(electricityPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        electricityPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        electricityPhysicalLeg = new ElectricityPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList environmentalPhysicalLegNodeList = xmlNode.SelectNodes("environmentalPhysicalLeg");

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

            foreach (XmlNode item in environmentalPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        environmentalPhysicalLegIDRef = item.Attributes["id"].Name;
                        EnvironmentalPhysicalLeg ob = EnvironmentalPhysicalLeg();
                        IDManager.SetID(environmentalPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        environmentalPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        environmentalPhysicalLeg = new EnvironmentalPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList fixedLegNodeList = xmlNode.SelectNodes("fixedLeg");

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

            foreach (XmlNode item in fixedLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fixedLegIDRef = item.Attributes["id"].Name;
                        FixedPriceLeg ob = FixedPriceLeg();
                        IDManager.SetID(fixedLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fixedLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fixedLeg = new FixedPriceLeg(item);
                    }
                }
            }


            XmlNodeList floatingLegNodeList = xmlNode.SelectNodes("floatingLeg");

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

            foreach (XmlNode item in floatingLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        floatingLegIDRef = item.Attributes["id"].Name;
                        FloatingPriceLeg ob = FloatingPriceLeg();
                        IDManager.SetID(floatingLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        floatingLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        floatingLeg = new FloatingPriceLeg(item);
                    }
                }
            }


            XmlNodeList gasPhysicalLegNodeList = xmlNode.SelectNodes("gasPhysicalLeg");

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

            foreach (XmlNode item in gasPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        gasPhysicalLegIDRef = item.Attributes["id"].Name;
                        GasPhysicalLeg ob = GasPhysicalLeg();
                        IDManager.SetID(gasPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        gasPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        gasPhysicalLeg = new GasPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList oilPhysicalLegNodeList = xmlNode.SelectNodes("oilPhysicalLeg");

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

            foreach (XmlNode item in oilPhysicalLegNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        oilPhysicalLegIDRef = item.Attributes["id"].Name;
                        OilPhysicalLeg ob = OilPhysicalLeg();
                        IDManager.SetID(oilPhysicalLegIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        oilPhysicalLegIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        oilPhysicalLeg = new OilPhysicalLeg(item);
                    }
                }
            }


            XmlNodeList weatherLegNodeList = xmlNode.SelectNodes("weatherLeg");

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


            XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");

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

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


            XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");

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

            foreach (XmlNode item in marketDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityMarketDisruption ob = CommodityMarketDisruption();
                        IDManager.SetID(marketDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        marketDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        marketDisruption = new CommodityMarketDisruption(item);
                    }
                }
            }


            XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");

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

            foreach (XmlNode item in settlementDisruptionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef = item.Attributes["id"].Name;
                        CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                        IDManager.SetID(settlementDisruptionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        settlementDisruptionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
                    }
                }
            }


            XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");

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

            foreach (XmlNode item in roundingNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        roundingIDRef = item.Attributes["id"].Name;
                        Rounding ob = Rounding();
                        IDManager.SetID(roundingIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        roundingIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        rounding = new Rounding(item);
                    }
                }
            }
        }
 public CommoditySwap(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 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;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(terminationDateNode);
                 IDManager.SetID(terminationDateIDRef_, ob);
             }
             else if (terminationDateNode.Attributes["href"] != null)
             {
                 terminationDateIDRef_ = terminationDateNode.Attributes["href"].Value;
             }
             else
             {
                 terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
             }
         }
         else
         {
             terminationDate_ = new AdjustableOrRelativeDate(terminationDateNode);
         }
     }
     
 
     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;
                 IdentifiedCurrency ob = new IdentifiedCurrency(settlementCurrencyNode);
                 IDManager.SetID(settlementCurrencyIDRef_, ob);
             }
             else if (settlementCurrencyNode.Attributes["href"] != null)
             {
                 settlementCurrencyIDRef_ = settlementCurrencyNode.Attributes["href"].Value;
             }
             else
             {
                 settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
             }
         }
         else
         {
             settlementCurrency_ = new IdentifiedCurrency(settlementCurrencyNode);
         }
     }
     
 
     XmlNode commoditySwapLegNode = xmlNode.SelectSingleNode("commoditySwapLeg");
     
     if (commoditySwapLegNode != null)
     {
         if (commoditySwapLegNode.Attributes["href"] != null || commoditySwapLegNode.Attributes["id"] != null) 
         {
             if (commoditySwapLegNode.Attributes["id"] != null) 
             {
                 commoditySwapLegIDRef_ = commoditySwapLegNode.Attributes["id"].Value;
                 CommoditySwapLeg ob = new CommoditySwapLeg(commoditySwapLegNode);
                 IDManager.SetID(commoditySwapLegIDRef_, ob);
             }
             else if (commoditySwapLegNode.Attributes["href"] != null)
             {
                 commoditySwapLegIDRef_ = commoditySwapLegNode.Attributes["href"].Value;
             }
             else
             {
                 commoditySwapLeg_ = new CommoditySwapLeg(commoditySwapLegNode);
             }
         }
         else
         {
             commoditySwapLeg_ = new CommoditySwapLeg(commoditySwapLegNode);
         }
     }
     
 
     XmlNode coalPhysicalLegNode = xmlNode.SelectSingleNode("coalPhysicalLeg");
     
     if (coalPhysicalLegNode != null)
     {
         if (coalPhysicalLegNode.Attributes["href"] != null || coalPhysicalLegNode.Attributes["id"] != null) 
         {
             if (coalPhysicalLegNode.Attributes["id"] != null) 
             {
                 coalPhysicalLegIDRef_ = coalPhysicalLegNode.Attributes["id"].Value;
                 CoalPhysicalLeg ob = new CoalPhysicalLeg(coalPhysicalLegNode);
                 IDManager.SetID(coalPhysicalLegIDRef_, ob);
             }
             else if (coalPhysicalLegNode.Attributes["href"] != null)
             {
                 coalPhysicalLegIDRef_ = coalPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 coalPhysicalLeg_ = new CoalPhysicalLeg(coalPhysicalLegNode);
             }
         }
         else
         {
             coalPhysicalLeg_ = new CoalPhysicalLeg(coalPhysicalLegNode);
         }
     }
     
 
     XmlNode electricityPhysicalLegNode = xmlNode.SelectSingleNode("electricityPhysicalLeg");
     
     if (electricityPhysicalLegNode != null)
     {
         if (electricityPhysicalLegNode.Attributes["href"] != null || electricityPhysicalLegNode.Attributes["id"] != null) 
         {
             if (electricityPhysicalLegNode.Attributes["id"] != null) 
             {
                 electricityPhysicalLegIDRef_ = electricityPhysicalLegNode.Attributes["id"].Value;
                 ElectricityPhysicalLeg ob = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
                 IDManager.SetID(electricityPhysicalLegIDRef_, ob);
             }
             else if (electricityPhysicalLegNode.Attributes["href"] != null)
             {
                 electricityPhysicalLegIDRef_ = electricityPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 electricityPhysicalLeg_ = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
             }
         }
         else
         {
             electricityPhysicalLeg_ = new ElectricityPhysicalLeg(electricityPhysicalLegNode);
         }
     }
     
 
     XmlNode environmentalPhysicalLegNode = xmlNode.SelectSingleNode("environmentalPhysicalLeg");
     
     if (environmentalPhysicalLegNode != null)
     {
         if (environmentalPhysicalLegNode.Attributes["href"] != null || environmentalPhysicalLegNode.Attributes["id"] != null) 
         {
             if (environmentalPhysicalLegNode.Attributes["id"] != null) 
             {
                 environmentalPhysicalLegIDRef_ = environmentalPhysicalLegNode.Attributes["id"].Value;
                 EnvironmentalPhysicalLeg ob = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
                 IDManager.SetID(environmentalPhysicalLegIDRef_, ob);
             }
             else if (environmentalPhysicalLegNode.Attributes["href"] != null)
             {
                 environmentalPhysicalLegIDRef_ = environmentalPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 environmentalPhysicalLeg_ = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
             }
         }
         else
         {
             environmentalPhysicalLeg_ = new EnvironmentalPhysicalLeg(environmentalPhysicalLegNode);
         }
     }
     
 
     XmlNode fixedLegNode = xmlNode.SelectSingleNode("fixedLeg");
     
     if (fixedLegNode != null)
     {
         if (fixedLegNode.Attributes["href"] != null || fixedLegNode.Attributes["id"] != null) 
         {
             if (fixedLegNode.Attributes["id"] != null) 
             {
                 fixedLegIDRef_ = fixedLegNode.Attributes["id"].Value;
                 FixedPriceLeg ob = new FixedPriceLeg(fixedLegNode);
                 IDManager.SetID(fixedLegIDRef_, ob);
             }
             else if (fixedLegNode.Attributes["href"] != null)
             {
                 fixedLegIDRef_ = fixedLegNode.Attributes["href"].Value;
             }
             else
             {
                 fixedLeg_ = new FixedPriceLeg(fixedLegNode);
             }
         }
         else
         {
             fixedLeg_ = new FixedPriceLeg(fixedLegNode);
         }
     }
     
 
     XmlNode floatingLegNode = xmlNode.SelectSingleNode("floatingLeg");
     
     if (floatingLegNode != null)
     {
         if (floatingLegNode.Attributes["href"] != null || floatingLegNode.Attributes["id"] != null) 
         {
             if (floatingLegNode.Attributes["id"] != null) 
             {
                 floatingLegIDRef_ = floatingLegNode.Attributes["id"].Value;
                 FloatingPriceLeg ob = new FloatingPriceLeg(floatingLegNode);
                 IDManager.SetID(floatingLegIDRef_, ob);
             }
             else if (floatingLegNode.Attributes["href"] != null)
             {
                 floatingLegIDRef_ = floatingLegNode.Attributes["href"].Value;
             }
             else
             {
                 floatingLeg_ = new FloatingPriceLeg(floatingLegNode);
             }
         }
         else
         {
             floatingLeg_ = new FloatingPriceLeg(floatingLegNode);
         }
     }
     
 
     XmlNode gasPhysicalLegNode = xmlNode.SelectSingleNode("gasPhysicalLeg");
     
     if (gasPhysicalLegNode != null)
     {
         if (gasPhysicalLegNode.Attributes["href"] != null || gasPhysicalLegNode.Attributes["id"] != null) 
         {
             if (gasPhysicalLegNode.Attributes["id"] != null) 
             {
                 gasPhysicalLegIDRef_ = gasPhysicalLegNode.Attributes["id"].Value;
                 GasPhysicalLeg ob = new GasPhysicalLeg(gasPhysicalLegNode);
                 IDManager.SetID(gasPhysicalLegIDRef_, ob);
             }
             else if (gasPhysicalLegNode.Attributes["href"] != null)
             {
                 gasPhysicalLegIDRef_ = gasPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 gasPhysicalLeg_ = new GasPhysicalLeg(gasPhysicalLegNode);
             }
         }
         else
         {
             gasPhysicalLeg_ = new GasPhysicalLeg(gasPhysicalLegNode);
         }
     }
     
 
     XmlNode oilPhysicalLegNode = xmlNode.SelectSingleNode("oilPhysicalLeg");
     
     if (oilPhysicalLegNode != null)
     {
         if (oilPhysicalLegNode.Attributes["href"] != null || oilPhysicalLegNode.Attributes["id"] != null) 
         {
             if (oilPhysicalLegNode.Attributes["id"] != null) 
             {
                 oilPhysicalLegIDRef_ = oilPhysicalLegNode.Attributes["id"].Value;
                 OilPhysicalLeg ob = new OilPhysicalLeg(oilPhysicalLegNode);
                 IDManager.SetID(oilPhysicalLegIDRef_, ob);
             }
             else if (oilPhysicalLegNode.Attributes["href"] != null)
             {
                 oilPhysicalLegIDRef_ = oilPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 oilPhysicalLeg_ = new OilPhysicalLeg(oilPhysicalLegNode);
             }
         }
         else
         {
             oilPhysicalLeg_ = new OilPhysicalLeg(oilPhysicalLegNode);
         }
     }
     
 
     XmlNodeList weatherLegNodeList = xmlNode.SelectNodes("weatherLeg");
     
     if (weatherLegNodeList != null)
     {
         this.weatherLeg_ = new List<WeatherLeg>();
         foreach (XmlNode item in weatherLegNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     weatherLegIDRef_ = item.Attributes["id"].Value;
                     weatherLeg_.Add(new WeatherLeg(item));
                     IDManager.SetID(weatherLegIDRef_, weatherLeg_[weatherLeg_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     weatherLegIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 weatherLeg_.Add(new WeatherLeg(item));
                 }
             }
             else
             {
                 weatherLeg_.Add(new WeatherLeg(item));
             }
         }
     }
     
 
     XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");
     
     if (commonPricingNode != null)
     {
         if (commonPricingNode.Attributes["href"] != null || commonPricingNode.Attributes["id"] != null) 
         {
             if (commonPricingNode.Attributes["id"] != null) 
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(commonPricingNode);
                 IDManager.SetID(commonPricingIDRef_, ob);
             }
             else if (commonPricingNode.Attributes["href"] != null)
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["href"].Value;
             }
             else
             {
                 commonPricing_ = new XsdTypeBoolean(commonPricingNode);
             }
         }
         else
         {
             commonPricing_ = new XsdTypeBoolean(commonPricingNode);
         }
     }
     
 
     XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");
     
     if (marketDisruptionNode != null)
     {
         if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null) 
         {
             if (marketDisruptionNode.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                 CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                 IDManager.SetID(marketDisruptionIDRef_, ob);
             }
             else if (marketDisruptionNode.Attributes["href"] != null)
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
             }
         }
         else
         {
             marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
         }
     }
     
 
     XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");
     
     if (settlementDisruptionNode != null)
     {
         if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null) 
         {
             if (settlementDisruptionNode.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                 CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                 IDManager.SetID(settlementDisruptionIDRef_, ob);
             }
             else if (settlementDisruptionNode.Attributes["href"] != null)
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
             }
         }
         else
         {
             settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
         }
     }
     
 
     XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");
     
     if (roundingNode != null)
     {
         if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) 
         {
             if (roundingNode.Attributes["id"] != null) 
             {
                 roundingIDRef_ = roundingNode.Attributes["id"].Value;
                 Rounding ob = new Rounding(roundingNode);
                 IDManager.SetID(roundingIDRef_, ob);
             }
             else if (roundingNode.Attributes["href"] != null)
             {
                 roundingIDRef_ = roundingNode.Attributes["href"].Value;
             }
             else
             {
                 rounding_ = new Rounding(roundingNode);
             }
         }
         else
         {
             rounding_ = new Rounding(roundingNode);
         }
     }
     
 
 }
        public CommoditySwaption(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);
                }
            }


            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;
                        PutCallEnum ob = new PutCallEnum(optionTypeNode);
                        IDManager.SetID(optionTypeIDRef_, ob);
                    }
                    else if (optionTypeNode.Attributes["href"] != null)
                    {
                        optionTypeIDRef_ = optionTypeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        optionType_ = new PutCallEnum(optionTypeNode);
                    }
                }
                else
                {
                    optionType_ = new PutCallEnum(optionTypeNode);
                }
            }


            XmlNode commoditySwapNode = xmlNode.SelectSingleNode("commoditySwap");

            if (commoditySwapNode != null)
            {
                if (commoditySwapNode.Attributes["href"] != null || commoditySwapNode.Attributes["id"] != null)
                {
                    if (commoditySwapNode.Attributes["id"] != null)
                    {
                        commoditySwapIDRef_ = commoditySwapNode.Attributes["id"].Value;
                        CommoditySwaptionUnderlying ob = new CommoditySwaptionUnderlying(commoditySwapNode);
                        IDManager.SetID(commoditySwapIDRef_, ob);
                    }
                    else if (commoditySwapNode.Attributes["href"] != null)
                    {
                        commoditySwapIDRef_ = commoditySwapNode.Attributes["href"].Value;
                    }
                    else
                    {
                        commoditySwap_ = new CommoditySwaptionUnderlying(commoditySwapNode);
                    }
                }
                else
                {
                    commoditySwap_ = new CommoditySwaptionUnderlying(commoditySwapNode);
                }
            }


            XmlNode physicalExerciseNode = xmlNode.SelectSingleNode("physicalExercise");

            if (physicalExerciseNode != null)
            {
                if (physicalExerciseNode.Attributes["href"] != null || physicalExerciseNode.Attributes["id"] != null)
                {
                    if (physicalExerciseNode.Attributes["id"] != null)
                    {
                        physicalExerciseIDRef_ = physicalExerciseNode.Attributes["id"].Value;
                        CommodityPhysicalExercise ob = new CommodityPhysicalExercise(physicalExerciseNode);
                        IDManager.SetID(physicalExerciseIDRef_, ob);
                    }
                    else if (physicalExerciseNode.Attributes["href"] != null)
                    {
                        physicalExerciseIDRef_ = physicalExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
                    }
                }
                else
                {
                    physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
                }
            }


            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;
                        CommodityPremium ob = new CommodityPremium(premiumNode);
                        IDManager.SetID(premiumIDRef_, ob);
                    }
                    else if (premiumNode.Attributes["href"] != null)
                    {
                        premiumIDRef_ = premiumNode.Attributes["href"].Value;
                    }
                    else
                    {
                        premium_ = new CommodityPremium(premiumNode);
                    }
                }
                else
                {
                    premium_ = new CommodityPremium(premiumNode);
                }
            }


            XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");

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


            XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");

            if (marketDisruptionNode != null)
            {
                if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null)
                {
                    if (marketDisruptionNode.Attributes["id"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                        CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                        IDManager.SetID(marketDisruptionIDRef_, ob);
                    }
                    else if (marketDisruptionNode.Attributes["href"] != null)
                    {
                        marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                    }
                }
                else
                {
                    marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
                }
            }


            XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");

            if (settlementDisruptionNode != null)
            {
                if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null)
                {
                    if (settlementDisruptionNode.Attributes["id"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                        CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                        IDManager.SetID(settlementDisruptionIDRef_, ob);
                    }
                    else if (settlementDisruptionNode.Attributes["href"] != null)
                    {
                        settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                    }
                }
                else
                {
                    settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                }
            }


            XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");

            if (roundingNode != null)
            {
                if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null)
                {
                    if (roundingNode.Attributes["id"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["id"].Value;
                        Rounding ob = new Rounding(roundingNode);
                        IDManager.SetID(roundingIDRef_, ob);
                    }
                    else if (roundingNode.Attributes["href"] != null)
                    {
                        roundingIDRef_ = roundingNode.Attributes["href"].Value;
                    }
                    else
                    {
                        rounding_ = new Rounding(roundingNode);
                    }
                }
                else
                {
                    rounding_ = new Rounding(roundingNode);
                }
            }
        }
 public CommodityForward(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList valueDateNodeList = xmlNode.SelectNodes("valueDate");
     if (valueDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in valueDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 valueDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(valueDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 valueDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 valueDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList fixedLegNodeList = xmlNode.SelectNodes("fixedLeg");
     if (fixedLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fixedLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fixedLegIDRef = item.Attributes["id"].Name;
                 NonPeriodicFixedPriceLeg ob = NonPeriodicFixedPriceLeg();
                 IDManager.SetID(fixedLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fixedLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fixedLeg = new NonPeriodicFixedPriceLeg(item);
             }
         }
     }
     
 
     XmlNodeList averagePriceLegNodeList = xmlNode.SelectNodes("averagePriceLeg");
     if (averagePriceLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in averagePriceLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 averagePriceLegIDRef = item.Attributes["id"].Name;
                 AveragePriceLeg ob = AveragePriceLeg();
                 IDManager.SetID(averagePriceLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 averagePriceLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 averagePriceLeg = new AveragePriceLeg(item);
             }
         }
     }
     
 
     XmlNodeList commodityForwardLegNodeList = xmlNode.SelectNodes("commodityForwardLeg");
     if (commodityForwardLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commodityForwardLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commodityForwardLegIDRef = item.Attributes["id"].Name;
                 CommodityForwardLeg ob = CommodityForwardLeg();
                 IDManager.SetID(commodityForwardLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commodityForwardLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commodityForwardLeg = new CommodityForwardLeg(item);
             }
         }
     }
     
 
     XmlNodeList bullionPhysicalLegNodeList = xmlNode.SelectNodes("bullionPhysicalLeg");
     if (bullionPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in bullionPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 bullionPhysicalLegIDRef = item.Attributes["id"].Name;
                 BullionPhysicalLeg ob = BullionPhysicalLeg();
                 IDManager.SetID(bullionPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 bullionPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 bullionPhysicalLeg = new BullionPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList metalPhysicalLegNodeList = xmlNode.SelectNodes("metalPhysicalLeg");
     if (metalPhysicalLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in metalPhysicalLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 metalPhysicalLegIDRef = item.Attributes["id"].Name;
                 MetalPhysicalLeg ob = MetalPhysicalLeg();
                 IDManager.SetID(metalPhysicalLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 metalPhysicalLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 metalPhysicalLeg = new MetalPhysicalLeg(item);
             }
         }
     }
     
 
     XmlNodeList commonPricingNodeList = xmlNode.SelectNodes("commonPricing");
     if (commonPricingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in commonPricingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 commonPricingIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(commonPricingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 commonPricingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 commonPricing = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList marketDisruptionNodeList = xmlNode.SelectNodes("marketDisruption");
     if (marketDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in marketDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityMarketDisruption ob = CommodityMarketDisruption();
                 IDManager.SetID(marketDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 marketDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 marketDisruption = new CommodityMarketDisruption(item);
             }
         }
     }
     
 
     XmlNodeList settlementDisruptionNodeList = xmlNode.SelectNodes("settlementDisruption");
     if (settlementDisruptionNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementDisruptionNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef = item.Attributes["id"].Name;
                 CommodityBullionSettlementDisruptionEnum ob = CommodityBullionSettlementDisruptionEnum();
                 IDManager.SetID(settlementDisruptionIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementDisruptionIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementDisruption = new CommodityBullionSettlementDisruptionEnum(item);
             }
         }
     }
     
 
     XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding");
     if (roundingNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in roundingNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 roundingIDRef = item.Attributes["id"].Name;
                 Rounding ob = Rounding();
                 IDManager.SetID(roundingIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 roundingIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rounding = new Rounding(item);
             }
         }
     }
     
 
 }
 public CommoditySwaption(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);
         }
     }
     
 
     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;
                 PutCallEnum ob = new PutCallEnum(optionTypeNode);
                 IDManager.SetID(optionTypeIDRef_, ob);
             }
             else if (optionTypeNode.Attributes["href"] != null)
             {
                 optionTypeIDRef_ = optionTypeNode.Attributes["href"].Value;
             }
             else
             {
                 optionType_ = new PutCallEnum(optionTypeNode);
             }
         }
         else
         {
             optionType_ = new PutCallEnum(optionTypeNode);
         }
     }
     
 
     XmlNode commoditySwapNode = xmlNode.SelectSingleNode("commoditySwap");
     
     if (commoditySwapNode != null)
     {
         if (commoditySwapNode.Attributes["href"] != null || commoditySwapNode.Attributes["id"] != null) 
         {
             if (commoditySwapNode.Attributes["id"] != null) 
             {
                 commoditySwapIDRef_ = commoditySwapNode.Attributes["id"].Value;
                 CommoditySwaptionUnderlying ob = new CommoditySwaptionUnderlying(commoditySwapNode);
                 IDManager.SetID(commoditySwapIDRef_, ob);
             }
             else if (commoditySwapNode.Attributes["href"] != null)
             {
                 commoditySwapIDRef_ = commoditySwapNode.Attributes["href"].Value;
             }
             else
             {
                 commoditySwap_ = new CommoditySwaptionUnderlying(commoditySwapNode);
             }
         }
         else
         {
             commoditySwap_ = new CommoditySwaptionUnderlying(commoditySwapNode);
         }
     }
     
 
     XmlNode physicalExerciseNode = xmlNode.SelectSingleNode("physicalExercise");
     
     if (physicalExerciseNode != null)
     {
         if (physicalExerciseNode.Attributes["href"] != null || physicalExerciseNode.Attributes["id"] != null) 
         {
             if (physicalExerciseNode.Attributes["id"] != null) 
             {
                 physicalExerciseIDRef_ = physicalExerciseNode.Attributes["id"].Value;
                 CommodityPhysicalExercise ob = new CommodityPhysicalExercise(physicalExerciseNode);
                 IDManager.SetID(physicalExerciseIDRef_, ob);
             }
             else if (physicalExerciseNode.Attributes["href"] != null)
             {
                 physicalExerciseIDRef_ = physicalExerciseNode.Attributes["href"].Value;
             }
             else
             {
                 physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
             }
         }
         else
         {
             physicalExercise_ = new CommodityPhysicalExercise(physicalExerciseNode);
         }
     }
     
 
     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;
                 CommodityPremium ob = new CommodityPremium(premiumNode);
                 IDManager.SetID(premiumIDRef_, ob);
             }
             else if (premiumNode.Attributes["href"] != null)
             {
                 premiumIDRef_ = premiumNode.Attributes["href"].Value;
             }
             else
             {
                 premium_ = new CommodityPremium(premiumNode);
             }
         }
         else
         {
             premium_ = new CommodityPremium(premiumNode);
         }
     }
     
 
     XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");
     
     if (commonPricingNode != null)
     {
         if (commonPricingNode.Attributes["href"] != null || commonPricingNode.Attributes["id"] != null) 
         {
             if (commonPricingNode.Attributes["id"] != null) 
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(commonPricingNode);
                 IDManager.SetID(commonPricingIDRef_, ob);
             }
             else if (commonPricingNode.Attributes["href"] != null)
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["href"].Value;
             }
             else
             {
                 commonPricing_ = new XsdTypeBoolean(commonPricingNode);
             }
         }
         else
         {
             commonPricing_ = new XsdTypeBoolean(commonPricingNode);
         }
     }
     
 
     XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");
     
     if (marketDisruptionNode != null)
     {
         if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null) 
         {
             if (marketDisruptionNode.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                 CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                 IDManager.SetID(marketDisruptionIDRef_, ob);
             }
             else if (marketDisruptionNode.Attributes["href"] != null)
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
             }
         }
         else
         {
             marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
         }
     }
     
 
     XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");
     
     if (settlementDisruptionNode != null)
     {
         if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null) 
         {
             if (settlementDisruptionNode.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                 CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                 IDManager.SetID(settlementDisruptionIDRef_, ob);
             }
             else if (settlementDisruptionNode.Attributes["href"] != null)
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
             }
         }
         else
         {
             settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
         }
     }
     
 
     XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");
     
     if (roundingNode != null)
     {
         if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) 
         {
             if (roundingNode.Attributes["id"] != null) 
             {
                 roundingIDRef_ = roundingNode.Attributes["id"].Value;
                 Rounding ob = new Rounding(roundingNode);
                 IDManager.SetID(roundingIDRef_, ob);
             }
             else if (roundingNode.Attributes["href"] != null)
             {
                 roundingIDRef_ = roundingNode.Attributes["href"].Value;
             }
             else
             {
                 rounding_ = new Rounding(roundingNode);
             }
         }
         else
         {
             rounding_ = new Rounding(roundingNode);
         }
     }
     
 
 }
 public CommodityForward(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode valueDateNode = xmlNode.SelectSingleNode("valueDate");
     
     if (valueDateNode != null)
     {
         if (valueDateNode.Attributes["href"] != null || valueDateNode.Attributes["id"] != null) 
         {
             if (valueDateNode.Attributes["id"] != null) 
             {
                 valueDateIDRef_ = valueDateNode.Attributes["id"].Value;
                 AdjustableOrRelativeDate ob = new AdjustableOrRelativeDate(valueDateNode);
                 IDManager.SetID(valueDateIDRef_, ob);
             }
             else if (valueDateNode.Attributes["href"] != null)
             {
                 valueDateIDRef_ = valueDateNode.Attributes["href"].Value;
             }
             else
             {
                 valueDate_ = new AdjustableOrRelativeDate(valueDateNode);
             }
         }
         else
         {
             valueDate_ = new AdjustableOrRelativeDate(valueDateNode);
         }
     }
     
 
     XmlNode fixedLegNode = xmlNode.SelectSingleNode("fixedLeg");
     
     if (fixedLegNode != null)
     {
         if (fixedLegNode.Attributes["href"] != null || fixedLegNode.Attributes["id"] != null) 
         {
             if (fixedLegNode.Attributes["id"] != null) 
             {
                 fixedLegIDRef_ = fixedLegNode.Attributes["id"].Value;
                 NonPeriodicFixedPriceLeg ob = new NonPeriodicFixedPriceLeg(fixedLegNode);
                 IDManager.SetID(fixedLegIDRef_, ob);
             }
             else if (fixedLegNode.Attributes["href"] != null)
             {
                 fixedLegIDRef_ = fixedLegNode.Attributes["href"].Value;
             }
             else
             {
                 fixedLeg_ = new NonPeriodicFixedPriceLeg(fixedLegNode);
             }
         }
         else
         {
             fixedLeg_ = new NonPeriodicFixedPriceLeg(fixedLegNode);
         }
     }
     
 
     XmlNode averagePriceLegNode = xmlNode.SelectSingleNode("averagePriceLeg");
     
     if (averagePriceLegNode != null)
     {
         if (averagePriceLegNode.Attributes["href"] != null || averagePriceLegNode.Attributes["id"] != null) 
         {
             if (averagePriceLegNode.Attributes["id"] != null) 
             {
                 averagePriceLegIDRef_ = averagePriceLegNode.Attributes["id"].Value;
                 AveragePriceLeg ob = new AveragePriceLeg(averagePriceLegNode);
                 IDManager.SetID(averagePriceLegIDRef_, ob);
             }
             else if (averagePriceLegNode.Attributes["href"] != null)
             {
                 averagePriceLegIDRef_ = averagePriceLegNode.Attributes["href"].Value;
             }
             else
             {
                 averagePriceLeg_ = new AveragePriceLeg(averagePriceLegNode);
             }
         }
         else
         {
             averagePriceLeg_ = new AveragePriceLeg(averagePriceLegNode);
         }
     }
     
 
     XmlNode commodityForwardLegNode = xmlNode.SelectSingleNode("commodityForwardLeg");
     
     if (commodityForwardLegNode != null)
     {
         if (commodityForwardLegNode.Attributes["href"] != null || commodityForwardLegNode.Attributes["id"] != null) 
         {
             if (commodityForwardLegNode.Attributes["id"] != null) 
             {
                 commodityForwardLegIDRef_ = commodityForwardLegNode.Attributes["id"].Value;
                 CommodityForwardLeg ob = new CommodityForwardLeg(commodityForwardLegNode);
                 IDManager.SetID(commodityForwardLegIDRef_, ob);
             }
             else if (commodityForwardLegNode.Attributes["href"] != null)
             {
                 commodityForwardLegIDRef_ = commodityForwardLegNode.Attributes["href"].Value;
             }
             else
             {
                 commodityForwardLeg_ = new CommodityForwardLeg(commodityForwardLegNode);
             }
         }
         else
         {
             commodityForwardLeg_ = new CommodityForwardLeg(commodityForwardLegNode);
         }
     }
     
 
     XmlNode bullionPhysicalLegNode = xmlNode.SelectSingleNode("bullionPhysicalLeg");
     
     if (bullionPhysicalLegNode != null)
     {
         if (bullionPhysicalLegNode.Attributes["href"] != null || bullionPhysicalLegNode.Attributes["id"] != null) 
         {
             if (bullionPhysicalLegNode.Attributes["id"] != null) 
             {
                 bullionPhysicalLegIDRef_ = bullionPhysicalLegNode.Attributes["id"].Value;
                 BullionPhysicalLeg ob = new BullionPhysicalLeg(bullionPhysicalLegNode);
                 IDManager.SetID(bullionPhysicalLegIDRef_, ob);
             }
             else if (bullionPhysicalLegNode.Attributes["href"] != null)
             {
                 bullionPhysicalLegIDRef_ = bullionPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 bullionPhysicalLeg_ = new BullionPhysicalLeg(bullionPhysicalLegNode);
             }
         }
         else
         {
             bullionPhysicalLeg_ = new BullionPhysicalLeg(bullionPhysicalLegNode);
         }
     }
     
 
     XmlNode metalPhysicalLegNode = xmlNode.SelectSingleNode("metalPhysicalLeg");
     
     if (metalPhysicalLegNode != null)
     {
         if (metalPhysicalLegNode.Attributes["href"] != null || metalPhysicalLegNode.Attributes["id"] != null) 
         {
             if (metalPhysicalLegNode.Attributes["id"] != null) 
             {
                 metalPhysicalLegIDRef_ = metalPhysicalLegNode.Attributes["id"].Value;
                 MetalPhysicalLeg ob = new MetalPhysicalLeg(metalPhysicalLegNode);
                 IDManager.SetID(metalPhysicalLegIDRef_, ob);
             }
             else if (metalPhysicalLegNode.Attributes["href"] != null)
             {
                 metalPhysicalLegIDRef_ = metalPhysicalLegNode.Attributes["href"].Value;
             }
             else
             {
                 metalPhysicalLeg_ = new MetalPhysicalLeg(metalPhysicalLegNode);
             }
         }
         else
         {
             metalPhysicalLeg_ = new MetalPhysicalLeg(metalPhysicalLegNode);
         }
     }
     
 
     XmlNode commonPricingNode = xmlNode.SelectSingleNode("commonPricing");
     
     if (commonPricingNode != null)
     {
         if (commonPricingNode.Attributes["href"] != null || commonPricingNode.Attributes["id"] != null) 
         {
             if (commonPricingNode.Attributes["id"] != null) 
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(commonPricingNode);
                 IDManager.SetID(commonPricingIDRef_, ob);
             }
             else if (commonPricingNode.Attributes["href"] != null)
             {
                 commonPricingIDRef_ = commonPricingNode.Attributes["href"].Value;
             }
             else
             {
                 commonPricing_ = new XsdTypeBoolean(commonPricingNode);
             }
         }
         else
         {
             commonPricing_ = new XsdTypeBoolean(commonPricingNode);
         }
     }
     
 
     XmlNode marketDisruptionNode = xmlNode.SelectSingleNode("marketDisruption");
     
     if (marketDisruptionNode != null)
     {
         if (marketDisruptionNode.Attributes["href"] != null || marketDisruptionNode.Attributes["id"] != null) 
         {
             if (marketDisruptionNode.Attributes["id"] != null) 
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["id"].Value;
                 CommodityMarketDisruption ob = new CommodityMarketDisruption(marketDisruptionNode);
                 IDManager.SetID(marketDisruptionIDRef_, ob);
             }
             else if (marketDisruptionNode.Attributes["href"] != null)
             {
                 marketDisruptionIDRef_ = marketDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
             }
         }
         else
         {
             marketDisruption_ = new CommodityMarketDisruption(marketDisruptionNode);
         }
     }
     
 
     XmlNode settlementDisruptionNode = xmlNode.SelectSingleNode("settlementDisruption");
     
     if (settlementDisruptionNode != null)
     {
         if (settlementDisruptionNode.Attributes["href"] != null || settlementDisruptionNode.Attributes["id"] != null) 
         {
             if (settlementDisruptionNode.Attributes["id"] != null) 
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["id"].Value;
                 CommodityBullionSettlementDisruptionEnum ob = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
                 IDManager.SetID(settlementDisruptionIDRef_, ob);
             }
             else if (settlementDisruptionNode.Attributes["href"] != null)
             {
                 settlementDisruptionIDRef_ = settlementDisruptionNode.Attributes["href"].Value;
             }
             else
             {
                 settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
             }
         }
         else
         {
             settlementDisruption_ = new CommodityBullionSettlementDisruptionEnum(settlementDisruptionNode);
         }
     }
     
 
     XmlNode roundingNode = xmlNode.SelectSingleNode("rounding");
     
     if (roundingNode != null)
     {
         if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) 
         {
             if (roundingNode.Attributes["id"] != null) 
             {
                 roundingIDRef_ = roundingNode.Attributes["id"].Value;
                 Rounding ob = new Rounding(roundingNode);
                 IDManager.SetID(roundingIDRef_, ob);
             }
             else if (roundingNode.Attributes["href"] != null)
             {
                 roundingIDRef_ = roundingNode.Attributes["href"].Value;
             }
             else
             {
                 rounding_ = new Rounding(roundingNode);
             }
         }
         else
         {
             rounding_ = new Rounding(roundingNode);
         }
     }
     
 
 }