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);
                }
            }
        }
Exemple #2
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)
 {
     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);
         }
     }
     
 
 }