Exemplo n.º 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 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 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);
                }
            }
        }
 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);
         }
     }
     
 
 }