public CommodityFx(XmlNode xmlNode)
        {
            XmlNodeList primaryRateSourceNodeList = xmlNode.SelectNodes("primaryRateSource");

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

            foreach (XmlNode item in primaryRateSourceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        primaryRateSourceIDRef = item.Attributes["id"].Name;
                        InformationSource ob = InformationSource();
                        IDManager.SetID(primaryRateSourceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        primaryRateSourceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        primaryRateSource = new InformationSource(item);
                    }
                }
            }


            XmlNodeList secondaryRateSourceNodeList = xmlNode.SelectNodes("secondaryRateSource");

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

            foreach (XmlNode item in secondaryRateSourceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        secondaryRateSourceIDRef = item.Attributes["id"].Name;
                        InformationSource ob = InformationSource();
                        IDManager.SetID(secondaryRateSourceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        secondaryRateSourceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        secondaryRateSource = new InformationSource(item);
                    }
                }
            }


            XmlNodeList fxTypeNodeList = xmlNode.SelectNodes("fxType");

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

            foreach (XmlNode item in fxTypeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fxTypeIDRef = item.Attributes["id"].Name;
                        CommodityFxType ob = CommodityFxType();
                        IDManager.SetID(fxTypeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fxTypeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fxType = new CommodityFxType(item);
                    }
                }
            }


            XmlNodeList averagingMethodNodeList = xmlNode.SelectNodes("averagingMethod");

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

            foreach (XmlNode item in averagingMethodNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        averagingMethodIDRef = item.Attributes["id"].Name;
                        AveragingMethodEnum ob = AveragingMethodEnum();
                        IDManager.SetID(averagingMethodIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        averagingMethodIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        averagingMethod = new AveragingMethodEnum(item);
                    }
                }
            }


            XmlNodeList fixingTimeNodeList = xmlNode.SelectNodes("fixingTime");

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

            foreach (XmlNode item in fixingTimeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        fixingTimeIDRef = item.Attributes["id"].Name;
                        BusinessCenterTime ob = BusinessCenterTime();
                        IDManager.SetID(fixingTimeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        fixingTimeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        fixingTime = new BusinessCenterTime(item);
                    }
                }
            }


            XmlNodeList fxObservationDatesNodeList = xmlNode.SelectNodes("fxObservationDates");

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


            XmlNodeList dayTypeNodeList = xmlNode.SelectNodes("dayType");

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

            foreach (XmlNode item in dayTypeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        dayTypeIDRef = item.Attributes["id"].Name;
                        CommodityDayTypeEnum ob = CommodityDayTypeEnum();
                        IDManager.SetID(dayTypeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        dayTypeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        dayType = new CommodityDayTypeEnum(item);
                    }
                }
            }


            XmlNodeList dayDistributionNodeList = xmlNode.SelectNodes("dayDistribution");

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

            foreach (XmlNode item in dayDistributionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        dayDistributionIDRef = item.Attributes["id"].Name;
                        CommodityFrequencyType ob = CommodityFrequencyType();
                        IDManager.SetID(dayDistributionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        dayDistributionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        dayDistribution = new CommodityFrequencyType(item);
                    }
                }
            }


            XmlNodeList dayCountNodeList = xmlNode.SelectNodes("dayCount");

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

            foreach (XmlNode item in dayCountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        dayCountIDRef = item.Attributes["id"].Name;
                        XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                        IDManager.SetID(dayCountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        dayCountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        dayCount = new XsdTypePositiveInteger(item);
                    }
                }
            }


            XmlNodeList dayOfWeekNodeList = xmlNode.SelectNodes("dayOfWeek");

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


            XmlNodeList dayNumberNodeList = xmlNode.SelectNodes("dayNumber");

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

            foreach (XmlNode item in dayNumberNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        dayNumberIDRef = item.Attributes["id"].Name;
                        XsdTypeInteger ob = XsdTypeInteger();
                        IDManager.SetID(dayNumberIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        dayNumberIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        dayNumber = new XsdTypeInteger(item);
                    }
                }
            }


            XmlNodeList lagNodeList = xmlNode.SelectNodes("lag");

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

            foreach (XmlNode item in lagNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        lagIDRef = item.Attributes["id"].Name;
                        Lag ob = Lag();
                        IDManager.SetID(lagIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        lagIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        lag = new Lag(item);
                    }
                }
            }


            XmlNodeList lagReferenceNodeList = xmlNode.SelectNodes("lagReference");

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

            foreach (XmlNode item in lagReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        lagReferenceIDRef = item.Attributes["id"].Name;
                        LagReference ob = LagReference();
                        IDManager.SetID(lagReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        lagReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        lagReference = new LagReference(item);
                    }
                }
            }


            XmlNodeList calculationPeriodsReferenceNodeList = xmlNode.SelectNodes("calculationPeriodsReference");

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

            foreach (XmlNode item in calculationPeriodsReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        calculationPeriodsReferenceIDRef = item.Attributes["id"].Name;
                        CalculationPeriodsReference ob = CalculationPeriodsReference();
                        IDManager.SetID(calculationPeriodsReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        calculationPeriodsReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        calculationPeriodsReference = new CalculationPeriodsReference(item);
                    }
                }
            }


            XmlNodeList calculationPeriodsScheduleReferenceNodeList = xmlNode.SelectNodes("calculationPeriodsScheduleReference");

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

            foreach (XmlNode item in calculationPeriodsScheduleReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        calculationPeriodsScheduleReferenceIDRef = item.Attributes["id"].Name;
                        CalculationPeriodsScheduleReference ob = CalculationPeriodsScheduleReference();
                        IDManager.SetID(calculationPeriodsScheduleReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        calculationPeriodsScheduleReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        calculationPeriodsScheduleReference = new CalculationPeriodsScheduleReference(item);
                    }
                }
            }


            XmlNodeList calculationPeriodsDatesReferenceNodeList = xmlNode.SelectNodes("calculationPeriodsDatesReference");

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

            foreach (XmlNode item in calculationPeriodsDatesReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        calculationPeriodsDatesReferenceIDRef = item.Attributes["id"].Name;
                        CalculationPeriodsDatesReference ob = CalculationPeriodsDatesReference();
                        IDManager.SetID(calculationPeriodsDatesReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        calculationPeriodsDatesReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        calculationPeriodsDatesReference = new CalculationPeriodsDatesReference(item);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public CommodityFx(XmlNode xmlNode)
        {
            XmlNode primaryRateSourceNode = xmlNode.SelectSingleNode("primaryRateSource");

            if (primaryRateSourceNode != null)
            {
                if (primaryRateSourceNode.Attributes["href"] != null || primaryRateSourceNode.Attributes["id"] != null)
                {
                    if (primaryRateSourceNode.Attributes["id"] != null)
                    {
                        primaryRateSourceIDRef_ = primaryRateSourceNode.Attributes["id"].Value;
                        InformationSource ob = new InformationSource(primaryRateSourceNode);
                        IDManager.SetID(primaryRateSourceIDRef_, ob);
                    }
                    else if (primaryRateSourceNode.Attributes["href"] != null)
                    {
                        primaryRateSourceIDRef_ = primaryRateSourceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        primaryRateSource_ = new InformationSource(primaryRateSourceNode);
                    }
                }
                else
                {
                    primaryRateSource_ = new InformationSource(primaryRateSourceNode);
                }
            }


            XmlNode secondaryRateSourceNode = xmlNode.SelectSingleNode("secondaryRateSource");

            if (secondaryRateSourceNode != null)
            {
                if (secondaryRateSourceNode.Attributes["href"] != null || secondaryRateSourceNode.Attributes["id"] != null)
                {
                    if (secondaryRateSourceNode.Attributes["id"] != null)
                    {
                        secondaryRateSourceIDRef_ = secondaryRateSourceNode.Attributes["id"].Value;
                        InformationSource ob = new InformationSource(secondaryRateSourceNode);
                        IDManager.SetID(secondaryRateSourceIDRef_, ob);
                    }
                    else if (secondaryRateSourceNode.Attributes["href"] != null)
                    {
                        secondaryRateSourceIDRef_ = secondaryRateSourceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        secondaryRateSource_ = new InformationSource(secondaryRateSourceNode);
                    }
                }
                else
                {
                    secondaryRateSource_ = new InformationSource(secondaryRateSourceNode);
                }
            }


            XmlNode fxTypeNode = xmlNode.SelectSingleNode("fxType");

            if (fxTypeNode != null)
            {
                if (fxTypeNode.Attributes["href"] != null || fxTypeNode.Attributes["id"] != null)
                {
                    if (fxTypeNode.Attributes["id"] != null)
                    {
                        fxTypeIDRef_ = fxTypeNode.Attributes["id"].Value;
                        CommodityFxType ob = new CommodityFxType(fxTypeNode);
                        IDManager.SetID(fxTypeIDRef_, ob);
                    }
                    else if (fxTypeNode.Attributes["href"] != null)
                    {
                        fxTypeIDRef_ = fxTypeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fxType_ = new CommodityFxType(fxTypeNode);
                    }
                }
                else
                {
                    fxType_ = new CommodityFxType(fxTypeNode);
                }
            }


            XmlNode averagingMethodNode = xmlNode.SelectSingleNode("averagingMethod");

            if (averagingMethodNode != null)
            {
                if (averagingMethodNode.Attributes["href"] != null || averagingMethodNode.Attributes["id"] != null)
                {
                    if (averagingMethodNode.Attributes["id"] != null)
                    {
                        averagingMethodIDRef_ = averagingMethodNode.Attributes["id"].Value;
                        AveragingMethodEnum ob = new AveragingMethodEnum(averagingMethodNode);
                        IDManager.SetID(averagingMethodIDRef_, ob);
                    }
                    else if (averagingMethodNode.Attributes["href"] != null)
                    {
                        averagingMethodIDRef_ = averagingMethodNode.Attributes["href"].Value;
                    }
                    else
                    {
                        averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
                    }
                }
                else
                {
                    averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
                }
            }


            XmlNode fixingTimeNode = xmlNode.SelectSingleNode("fixingTime");

            if (fixingTimeNode != null)
            {
                if (fixingTimeNode.Attributes["href"] != null || fixingTimeNode.Attributes["id"] != null)
                {
                    if (fixingTimeNode.Attributes["id"] != null)
                    {
                        fixingTimeIDRef_ = fixingTimeNode.Attributes["id"].Value;
                        BusinessCenterTime ob = new BusinessCenterTime(fixingTimeNode);
                        IDManager.SetID(fixingTimeIDRef_, ob);
                    }
                    else if (fixingTimeNode.Attributes["href"] != null)
                    {
                        fixingTimeIDRef_ = fixingTimeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        fixingTime_ = new BusinessCenterTime(fixingTimeNode);
                    }
                }
                else
                {
                    fixingTime_ = new BusinessCenterTime(fixingTimeNode);
                }
            }


            XmlNodeList fxObservationDatesNodeList = xmlNode.SelectNodes("fxObservationDates");

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


            XmlNode dayTypeNode = xmlNode.SelectSingleNode("dayType");

            if (dayTypeNode != null)
            {
                if (dayTypeNode.Attributes["href"] != null || dayTypeNode.Attributes["id"] != null)
                {
                    if (dayTypeNode.Attributes["id"] != null)
                    {
                        dayTypeIDRef_ = dayTypeNode.Attributes["id"].Value;
                        CommodityDayTypeEnum ob = new CommodityDayTypeEnum(dayTypeNode);
                        IDManager.SetID(dayTypeIDRef_, ob);
                    }
                    else if (dayTypeNode.Attributes["href"] != null)
                    {
                        dayTypeIDRef_ = dayTypeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        dayType_ = new CommodityDayTypeEnum(dayTypeNode);
                    }
                }
                else
                {
                    dayType_ = new CommodityDayTypeEnum(dayTypeNode);
                }
            }


            XmlNode dayDistributionNode = xmlNode.SelectSingleNode("dayDistribution");

            if (dayDistributionNode != null)
            {
                if (dayDistributionNode.Attributes["href"] != null || dayDistributionNode.Attributes["id"] != null)
                {
                    if (dayDistributionNode.Attributes["id"] != null)
                    {
                        dayDistributionIDRef_ = dayDistributionNode.Attributes["id"].Value;
                        CommodityFrequencyType ob = new CommodityFrequencyType(dayDistributionNode);
                        IDManager.SetID(dayDistributionIDRef_, ob);
                    }
                    else if (dayDistributionNode.Attributes["href"] != null)
                    {
                        dayDistributionIDRef_ = dayDistributionNode.Attributes["href"].Value;
                    }
                    else
                    {
                        dayDistribution_ = new CommodityFrequencyType(dayDistributionNode);
                    }
                }
                else
                {
                    dayDistribution_ = new CommodityFrequencyType(dayDistributionNode);
                }
            }


            XmlNode dayCountNode = xmlNode.SelectSingleNode("dayCount");

            if (dayCountNode != null)
            {
                if (dayCountNode.Attributes["href"] != null || dayCountNode.Attributes["id"] != null)
                {
                    if (dayCountNode.Attributes["id"] != null)
                    {
                        dayCountIDRef_ = dayCountNode.Attributes["id"].Value;
                        XsdTypePositiveInteger ob = new XsdTypePositiveInteger(dayCountNode);
                        IDManager.SetID(dayCountIDRef_, ob);
                    }
                    else if (dayCountNode.Attributes["href"] != null)
                    {
                        dayCountIDRef_ = dayCountNode.Attributes["href"].Value;
                    }
                    else
                    {
                        dayCount_ = new XsdTypePositiveInteger(dayCountNode);
                    }
                }
                else
                {
                    dayCount_ = new XsdTypePositiveInteger(dayCountNode);
                }
            }


            XmlNodeList dayOfWeekNodeList = xmlNode.SelectNodes("dayOfWeek");

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


            XmlNode dayNumberNode = xmlNode.SelectSingleNode("dayNumber");

            if (dayNumberNode != null)
            {
                if (dayNumberNode.Attributes["href"] != null || dayNumberNode.Attributes["id"] != null)
                {
                    if (dayNumberNode.Attributes["id"] != null)
                    {
                        dayNumberIDRef_ = dayNumberNode.Attributes["id"].Value;
                        XsdTypeInteger ob = new XsdTypeInteger(dayNumberNode);
                        IDManager.SetID(dayNumberIDRef_, ob);
                    }
                    else if (dayNumberNode.Attributes["href"] != null)
                    {
                        dayNumberIDRef_ = dayNumberNode.Attributes["href"].Value;
                    }
                    else
                    {
                        dayNumber_ = new XsdTypeInteger(dayNumberNode);
                    }
                }
                else
                {
                    dayNumber_ = new XsdTypeInteger(dayNumberNode);
                }
            }


            XmlNode lagNode = xmlNode.SelectSingleNode("lag");

            if (lagNode != null)
            {
                if (lagNode.Attributes["href"] != null || lagNode.Attributes["id"] != null)
                {
                    if (lagNode.Attributes["id"] != null)
                    {
                        lagIDRef_ = lagNode.Attributes["id"].Value;
                        Lag ob = new Lag(lagNode);
                        IDManager.SetID(lagIDRef_, ob);
                    }
                    else if (lagNode.Attributes["href"] != null)
                    {
                        lagIDRef_ = lagNode.Attributes["href"].Value;
                    }
                    else
                    {
                        lag_ = new Lag(lagNode);
                    }
                }
                else
                {
                    lag_ = new Lag(lagNode);
                }
            }


            XmlNode lagReferenceNode = xmlNode.SelectSingleNode("lagReference");

            if (lagReferenceNode != null)
            {
                if (lagReferenceNode.Attributes["href"] != null || lagReferenceNode.Attributes["id"] != null)
                {
                    if (lagReferenceNode.Attributes["id"] != null)
                    {
                        lagReferenceIDRef_ = lagReferenceNode.Attributes["id"].Value;
                        LagReference ob = new LagReference(lagReferenceNode);
                        IDManager.SetID(lagReferenceIDRef_, ob);
                    }
                    else if (lagReferenceNode.Attributes["href"] != null)
                    {
                        lagReferenceIDRef_ = lagReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        lagReference_ = new LagReference(lagReferenceNode);
                    }
                }
                else
                {
                    lagReference_ = new LagReference(lagReferenceNode);
                }
            }


            XmlNode calculationPeriodsReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsReference");

            if (calculationPeriodsReferenceNode != null)
            {
                if (calculationPeriodsReferenceNode.Attributes["href"] != null || calculationPeriodsReferenceNode.Attributes["id"] != null)
                {
                    if (calculationPeriodsReferenceNode.Attributes["id"] != null)
                    {
                        calculationPeriodsReferenceIDRef_ = calculationPeriodsReferenceNode.Attributes["id"].Value;
                        CalculationPeriodsReference ob = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
                        IDManager.SetID(calculationPeriodsReferenceIDRef_, ob);
                    }
                    else if (calculationPeriodsReferenceNode.Attributes["href"] != null)
                    {
                        calculationPeriodsReferenceIDRef_ = calculationPeriodsReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        calculationPeriodsReference_ = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
                    }
                }
                else
                {
                    calculationPeriodsReference_ = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
                }
            }


            XmlNode calculationPeriodsScheduleReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsScheduleReference");

            if (calculationPeriodsScheduleReferenceNode != null)
            {
                if (calculationPeriodsScheduleReferenceNode.Attributes["href"] != null || calculationPeriodsScheduleReferenceNode.Attributes["id"] != null)
                {
                    if (calculationPeriodsScheduleReferenceNode.Attributes["id"] != null)
                    {
                        calculationPeriodsScheduleReferenceIDRef_ = calculationPeriodsScheduleReferenceNode.Attributes["id"].Value;
                        CalculationPeriodsScheduleReference ob = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
                        IDManager.SetID(calculationPeriodsScheduleReferenceIDRef_, ob);
                    }
                    else if (calculationPeriodsScheduleReferenceNode.Attributes["href"] != null)
                    {
                        calculationPeriodsScheduleReferenceIDRef_ = calculationPeriodsScheduleReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        calculationPeriodsScheduleReference_ = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
                    }
                }
                else
                {
                    calculationPeriodsScheduleReference_ = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
                }
            }


            XmlNode calculationPeriodsDatesReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsDatesReference");

            if (calculationPeriodsDatesReferenceNode != null)
            {
                if (calculationPeriodsDatesReferenceNode.Attributes["href"] != null || calculationPeriodsDatesReferenceNode.Attributes["id"] != null)
                {
                    if (calculationPeriodsDatesReferenceNode.Attributes["id"] != null)
                    {
                        calculationPeriodsDatesReferenceIDRef_ = calculationPeriodsDatesReferenceNode.Attributes["id"].Value;
                        CalculationPeriodsDatesReference ob = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
                        IDManager.SetID(calculationPeriodsDatesReferenceIDRef_, ob);
                    }
                    else if (calculationPeriodsDatesReferenceNode.Attributes["href"] != null)
                    {
                        calculationPeriodsDatesReferenceIDRef_ = calculationPeriodsDatesReferenceNode.Attributes["href"].Value;
                    }
                    else
                    {
                        calculationPeriodsDatesReference_ = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
                    }
                }
                else
                {
                    calculationPeriodsDatesReference_ = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
                }
            }
        }
 public CommodityFx(XmlNode xmlNode)
 {
     XmlNode primaryRateSourceNode = xmlNode.SelectSingleNode("primaryRateSource");
     
     if (primaryRateSourceNode != null)
     {
         if (primaryRateSourceNode.Attributes["href"] != null || primaryRateSourceNode.Attributes["id"] != null) 
         {
             if (primaryRateSourceNode.Attributes["id"] != null) 
             {
                 primaryRateSourceIDRef_ = primaryRateSourceNode.Attributes["id"].Value;
                 InformationSource ob = new InformationSource(primaryRateSourceNode);
                 IDManager.SetID(primaryRateSourceIDRef_, ob);
             }
             else if (primaryRateSourceNode.Attributes["href"] != null)
             {
                 primaryRateSourceIDRef_ = primaryRateSourceNode.Attributes["href"].Value;
             }
             else
             {
                 primaryRateSource_ = new InformationSource(primaryRateSourceNode);
             }
         }
         else
         {
             primaryRateSource_ = new InformationSource(primaryRateSourceNode);
         }
     }
     
 
     XmlNode secondaryRateSourceNode = xmlNode.SelectSingleNode("secondaryRateSource");
     
     if (secondaryRateSourceNode != null)
     {
         if (secondaryRateSourceNode.Attributes["href"] != null || secondaryRateSourceNode.Attributes["id"] != null) 
         {
             if (secondaryRateSourceNode.Attributes["id"] != null) 
             {
                 secondaryRateSourceIDRef_ = secondaryRateSourceNode.Attributes["id"].Value;
                 InformationSource ob = new InformationSource(secondaryRateSourceNode);
                 IDManager.SetID(secondaryRateSourceIDRef_, ob);
             }
             else if (secondaryRateSourceNode.Attributes["href"] != null)
             {
                 secondaryRateSourceIDRef_ = secondaryRateSourceNode.Attributes["href"].Value;
             }
             else
             {
                 secondaryRateSource_ = new InformationSource(secondaryRateSourceNode);
             }
         }
         else
         {
             secondaryRateSource_ = new InformationSource(secondaryRateSourceNode);
         }
     }
     
 
     XmlNode fxTypeNode = xmlNode.SelectSingleNode("fxType");
     
     if (fxTypeNode != null)
     {
         if (fxTypeNode.Attributes["href"] != null || fxTypeNode.Attributes["id"] != null) 
         {
             if (fxTypeNode.Attributes["id"] != null) 
             {
                 fxTypeIDRef_ = fxTypeNode.Attributes["id"].Value;
                 CommodityFxType ob = new CommodityFxType(fxTypeNode);
                 IDManager.SetID(fxTypeIDRef_, ob);
             }
             else if (fxTypeNode.Attributes["href"] != null)
             {
                 fxTypeIDRef_ = fxTypeNode.Attributes["href"].Value;
             }
             else
             {
                 fxType_ = new CommodityFxType(fxTypeNode);
             }
         }
         else
         {
             fxType_ = new CommodityFxType(fxTypeNode);
         }
     }
     
 
     XmlNode averagingMethodNode = xmlNode.SelectSingleNode("averagingMethod");
     
     if (averagingMethodNode != null)
     {
         if (averagingMethodNode.Attributes["href"] != null || averagingMethodNode.Attributes["id"] != null) 
         {
             if (averagingMethodNode.Attributes["id"] != null) 
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["id"].Value;
                 AveragingMethodEnum ob = new AveragingMethodEnum(averagingMethodNode);
                 IDManager.SetID(averagingMethodIDRef_, ob);
             }
             else if (averagingMethodNode.Attributes["href"] != null)
             {
                 averagingMethodIDRef_ = averagingMethodNode.Attributes["href"].Value;
             }
             else
             {
                 averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
             }
         }
         else
         {
             averagingMethod_ = new AveragingMethodEnum(averagingMethodNode);
         }
     }
     
 
     XmlNode fixingTimeNode = xmlNode.SelectSingleNode("fixingTime");
     
     if (fixingTimeNode != null)
     {
         if (fixingTimeNode.Attributes["href"] != null || fixingTimeNode.Attributes["id"] != null) 
         {
             if (fixingTimeNode.Attributes["id"] != null) 
             {
                 fixingTimeIDRef_ = fixingTimeNode.Attributes["id"].Value;
                 BusinessCenterTime ob = new BusinessCenterTime(fixingTimeNode);
                 IDManager.SetID(fixingTimeIDRef_, ob);
             }
             else if (fixingTimeNode.Attributes["href"] != null)
             {
                 fixingTimeIDRef_ = fixingTimeNode.Attributes["href"].Value;
             }
             else
             {
                 fixingTime_ = new BusinessCenterTime(fixingTimeNode);
             }
         }
         else
         {
             fixingTime_ = new BusinessCenterTime(fixingTimeNode);
         }
     }
     
 
     XmlNodeList fxObservationDatesNodeList = xmlNode.SelectNodes("fxObservationDates");
     
     if (fxObservationDatesNodeList != null)
     {
         this.fxObservationDates_ = new List<AdjustableDates>();
         foreach (XmlNode item in fxObservationDatesNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     fxObservationDatesIDRef_ = item.Attributes["id"].Value;
                     fxObservationDates_.Add(new AdjustableDates(item));
                     IDManager.SetID(fxObservationDatesIDRef_, fxObservationDates_[fxObservationDates_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     fxObservationDatesIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 fxObservationDates_.Add(new AdjustableDates(item));
                 }
             }
             else
             {
                 fxObservationDates_.Add(new AdjustableDates(item));
             }
         }
     }
     
 
     XmlNode dayTypeNode = xmlNode.SelectSingleNode("dayType");
     
     if (dayTypeNode != null)
     {
         if (dayTypeNode.Attributes["href"] != null || dayTypeNode.Attributes["id"] != null) 
         {
             if (dayTypeNode.Attributes["id"] != null) 
             {
                 dayTypeIDRef_ = dayTypeNode.Attributes["id"].Value;
                 CommodityDayTypeEnum ob = new CommodityDayTypeEnum(dayTypeNode);
                 IDManager.SetID(dayTypeIDRef_, ob);
             }
             else if (dayTypeNode.Attributes["href"] != null)
             {
                 dayTypeIDRef_ = dayTypeNode.Attributes["href"].Value;
             }
             else
             {
                 dayType_ = new CommodityDayTypeEnum(dayTypeNode);
             }
         }
         else
         {
             dayType_ = new CommodityDayTypeEnum(dayTypeNode);
         }
     }
     
 
     XmlNode dayDistributionNode = xmlNode.SelectSingleNode("dayDistribution");
     
     if (dayDistributionNode != null)
     {
         if (dayDistributionNode.Attributes["href"] != null || dayDistributionNode.Attributes["id"] != null) 
         {
             if (dayDistributionNode.Attributes["id"] != null) 
             {
                 dayDistributionIDRef_ = dayDistributionNode.Attributes["id"].Value;
                 CommodityFrequencyType ob = new CommodityFrequencyType(dayDistributionNode);
                 IDManager.SetID(dayDistributionIDRef_, ob);
             }
             else if (dayDistributionNode.Attributes["href"] != null)
             {
                 dayDistributionIDRef_ = dayDistributionNode.Attributes["href"].Value;
             }
             else
             {
                 dayDistribution_ = new CommodityFrequencyType(dayDistributionNode);
             }
         }
         else
         {
             dayDistribution_ = new CommodityFrequencyType(dayDistributionNode);
         }
     }
     
 
     XmlNode dayCountNode = xmlNode.SelectSingleNode("dayCount");
     
     if (dayCountNode != null)
     {
         if (dayCountNode.Attributes["href"] != null || dayCountNode.Attributes["id"] != null) 
         {
             if (dayCountNode.Attributes["id"] != null) 
             {
                 dayCountIDRef_ = dayCountNode.Attributes["id"].Value;
                 XsdTypePositiveInteger ob = new XsdTypePositiveInteger(dayCountNode);
                 IDManager.SetID(dayCountIDRef_, ob);
             }
             else if (dayCountNode.Attributes["href"] != null)
             {
                 dayCountIDRef_ = dayCountNode.Attributes["href"].Value;
             }
             else
             {
                 dayCount_ = new XsdTypePositiveInteger(dayCountNode);
             }
         }
         else
         {
             dayCount_ = new XsdTypePositiveInteger(dayCountNode);
         }
     }
     
 
     XmlNodeList dayOfWeekNodeList = xmlNode.SelectNodes("dayOfWeek");
     
     if (dayOfWeekNodeList != null)
     {
         this.dayOfWeek_ = new List<DayOfWeekEnum>();
         foreach (XmlNode item in dayOfWeekNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     dayOfWeekIDRef_ = item.Attributes["id"].Value;
                     dayOfWeek_.Add(new DayOfWeekEnum(item));
                     IDManager.SetID(dayOfWeekIDRef_, dayOfWeek_[dayOfWeek_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     dayOfWeekIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 dayOfWeek_.Add(new DayOfWeekEnum(item));
                 }
             }
             else
             {
                 dayOfWeek_.Add(new DayOfWeekEnum(item));
             }
         }
     }
     
 
     XmlNode dayNumberNode = xmlNode.SelectSingleNode("dayNumber");
     
     if (dayNumberNode != null)
     {
         if (dayNumberNode.Attributes["href"] != null || dayNumberNode.Attributes["id"] != null) 
         {
             if (dayNumberNode.Attributes["id"] != null) 
             {
                 dayNumberIDRef_ = dayNumberNode.Attributes["id"].Value;
                 XsdTypeInteger ob = new XsdTypeInteger(dayNumberNode);
                 IDManager.SetID(dayNumberIDRef_, ob);
             }
             else if (dayNumberNode.Attributes["href"] != null)
             {
                 dayNumberIDRef_ = dayNumberNode.Attributes["href"].Value;
             }
             else
             {
                 dayNumber_ = new XsdTypeInteger(dayNumberNode);
             }
         }
         else
         {
             dayNumber_ = new XsdTypeInteger(dayNumberNode);
         }
     }
     
 
     XmlNode lagNode = xmlNode.SelectSingleNode("lag");
     
     if (lagNode != null)
     {
         if (lagNode.Attributes["href"] != null || lagNode.Attributes["id"] != null) 
         {
             if (lagNode.Attributes["id"] != null) 
             {
                 lagIDRef_ = lagNode.Attributes["id"].Value;
                 Lag ob = new Lag(lagNode);
                 IDManager.SetID(lagIDRef_, ob);
             }
             else if (lagNode.Attributes["href"] != null)
             {
                 lagIDRef_ = lagNode.Attributes["href"].Value;
             }
             else
             {
                 lag_ = new Lag(lagNode);
             }
         }
         else
         {
             lag_ = new Lag(lagNode);
         }
     }
     
 
     XmlNode lagReferenceNode = xmlNode.SelectSingleNode("lagReference");
     
     if (lagReferenceNode != null)
     {
         if (lagReferenceNode.Attributes["href"] != null || lagReferenceNode.Attributes["id"] != null) 
         {
             if (lagReferenceNode.Attributes["id"] != null) 
             {
                 lagReferenceIDRef_ = lagReferenceNode.Attributes["id"].Value;
                 LagReference ob = new LagReference(lagReferenceNode);
                 IDManager.SetID(lagReferenceIDRef_, ob);
             }
             else if (lagReferenceNode.Attributes["href"] != null)
             {
                 lagReferenceIDRef_ = lagReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 lagReference_ = new LagReference(lagReferenceNode);
             }
         }
         else
         {
             lagReference_ = new LagReference(lagReferenceNode);
         }
     }
     
 
     XmlNode calculationPeriodsReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsReference");
     
     if (calculationPeriodsReferenceNode != null)
     {
         if (calculationPeriodsReferenceNode.Attributes["href"] != null || calculationPeriodsReferenceNode.Attributes["id"] != null) 
         {
             if (calculationPeriodsReferenceNode.Attributes["id"] != null) 
             {
                 calculationPeriodsReferenceIDRef_ = calculationPeriodsReferenceNode.Attributes["id"].Value;
                 CalculationPeriodsReference ob = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
                 IDManager.SetID(calculationPeriodsReferenceIDRef_, ob);
             }
             else if (calculationPeriodsReferenceNode.Attributes["href"] != null)
             {
                 calculationPeriodsReferenceIDRef_ = calculationPeriodsReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 calculationPeriodsReference_ = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
             }
         }
         else
         {
             calculationPeriodsReference_ = new CalculationPeriodsReference(calculationPeriodsReferenceNode);
         }
     }
     
 
     XmlNode calculationPeriodsScheduleReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsScheduleReference");
     
     if (calculationPeriodsScheduleReferenceNode != null)
     {
         if (calculationPeriodsScheduleReferenceNode.Attributes["href"] != null || calculationPeriodsScheduleReferenceNode.Attributes["id"] != null) 
         {
             if (calculationPeriodsScheduleReferenceNode.Attributes["id"] != null) 
             {
                 calculationPeriodsScheduleReferenceIDRef_ = calculationPeriodsScheduleReferenceNode.Attributes["id"].Value;
                 CalculationPeriodsScheduleReference ob = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
                 IDManager.SetID(calculationPeriodsScheduleReferenceIDRef_, ob);
             }
             else if (calculationPeriodsScheduleReferenceNode.Attributes["href"] != null)
             {
                 calculationPeriodsScheduleReferenceIDRef_ = calculationPeriodsScheduleReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 calculationPeriodsScheduleReference_ = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
             }
         }
         else
         {
             calculationPeriodsScheduleReference_ = new CalculationPeriodsScheduleReference(calculationPeriodsScheduleReferenceNode);
         }
     }
     
 
     XmlNode calculationPeriodsDatesReferenceNode = xmlNode.SelectSingleNode("calculationPeriodsDatesReference");
     
     if (calculationPeriodsDatesReferenceNode != null)
     {
         if (calculationPeriodsDatesReferenceNode.Attributes["href"] != null || calculationPeriodsDatesReferenceNode.Attributes["id"] != null) 
         {
             if (calculationPeriodsDatesReferenceNode.Attributes["id"] != null) 
             {
                 calculationPeriodsDatesReferenceIDRef_ = calculationPeriodsDatesReferenceNode.Attributes["id"].Value;
                 CalculationPeriodsDatesReference ob = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
                 IDManager.SetID(calculationPeriodsDatesReferenceIDRef_, ob);
             }
             else if (calculationPeriodsDatesReferenceNode.Attributes["href"] != null)
             {
                 calculationPeriodsDatesReferenceIDRef_ = calculationPeriodsDatesReferenceNode.Attributes["href"].Value;
             }
             else
             {
                 calculationPeriodsDatesReference_ = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
             }
         }
         else
         {
             calculationPeriodsDatesReference_ = new CalculationPeriodsDatesReference(calculationPeriodsDatesReferenceNode);
         }
     }
     
 
 }