public TradeReferenceInformation(XmlNode xmlNode)
 {
     XmlNodeList originatingEventNodeList = xmlNode.SelectNodes("originatingEvent");
     if (originatingEventNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in originatingEventNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 originatingEventIDRef = item.Attributes["id"].Name;
                 OriginatingEvent ob = OriginatingEvent();
                 IDManager.SetID(originatingEventIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 originatingEventIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 originatingEvent = new OriginatingEvent(item);
             }
         }
     }
     
 
     XmlNodeList terminatingEventNodeList = xmlNode.SelectNodes("terminatingEvent");
     if (terminatingEventNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in terminatingEventNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 terminatingEventIDRef = item.Attributes["id"].Name;
                 TerminatingEvent ob = TerminatingEvent();
                 IDManager.SetID(terminatingEventIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 terminatingEventIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 terminatingEvent = new TerminatingEvent(item);
             }
         }
     }
     
 
     XmlNodeList partyTradeIdentifierNodeList = xmlNode.SelectNodes("partyTradeIdentifier");
     
     foreach (XmlNode item in partyTradeIdentifierNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 partyTradeIdentifierIDRef = item.Attributes["id"].Name;
                 List<PartyTradeIdentifier> ob = new List<PartyTradeIdentifier>();
                 ob.Add(new PartyTradeIdentifier(item));
                 IDManager.SetID(partyTradeIdentifierIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 partyTradeIdentifierIDRef = item.Attributes["href"].Name;
             }
             else
             {
             partyTradeIdentifier.Add(new PartyTradeIdentifier(item));
             }
         }
     }
     
 
     XmlNodeList partyTradeInformationNodeList = xmlNode.SelectNodes("partyTradeInformation");
     
     foreach (XmlNode item in partyTradeInformationNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 partyTradeInformationIDRef = item.Attributes["id"].Name;
                 List<PartyTradeInformation> ob = new List<PartyTradeInformation>();
                 ob.Add(new PartyTradeInformation(item));
                 IDManager.SetID(partyTradeInformationIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 partyTradeInformationIDRef = item.Attributes["href"].Name;
             }
             else
             {
             partyTradeInformation.Add(new PartyTradeInformation(item));
             }
         }
     }
     
 
     XmlNodeList productTypeNodeList = xmlNode.SelectNodes("productType");
     if (productTypeNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in productTypeNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 productTypeIDRef = item.Attributes["id"].Name;
                 ProductType ob = ProductType();
                 IDManager.SetID(productTypeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 productTypeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 productType = new ProductType(item);
             }
         }
     }
     
 
     XmlNodeList productIdNodeList = xmlNode.SelectNodes("productId");
     if (productIdNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in productIdNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 productIdIDRef = item.Attributes["id"].Name;
                 ProductId ob = ProductId();
                 IDManager.SetID(productIdIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 productIdIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 productId = new ProductId(item);
             }
         }
     }
     
 
 }
 public TradeReferenceInformation(XmlNode xmlNode)
 {
     XmlNode originatingEventNode = xmlNode.SelectSingleNode("originatingEvent");
     
     if (originatingEventNode != null)
     {
         if (originatingEventNode.Attributes["href"] != null || originatingEventNode.Attributes["id"] != null) 
         {
             if (originatingEventNode.Attributes["id"] != null) 
             {
                 originatingEventIDRef_ = originatingEventNode.Attributes["id"].Value;
                 OriginatingEvent ob = new OriginatingEvent(originatingEventNode);
                 IDManager.SetID(originatingEventIDRef_, ob);
             }
             else if (originatingEventNode.Attributes["href"] != null)
             {
                 originatingEventIDRef_ = originatingEventNode.Attributes["href"].Value;
             }
             else
             {
                 originatingEvent_ = new OriginatingEvent(originatingEventNode);
             }
         }
         else
         {
             originatingEvent_ = new OriginatingEvent(originatingEventNode);
         }
     }
     
 
     XmlNode terminatingEventNode = xmlNode.SelectSingleNode("terminatingEvent");
     
     if (terminatingEventNode != null)
     {
         if (terminatingEventNode.Attributes["href"] != null || terminatingEventNode.Attributes["id"] != null) 
         {
             if (terminatingEventNode.Attributes["id"] != null) 
             {
                 terminatingEventIDRef_ = terminatingEventNode.Attributes["id"].Value;
                 TerminatingEvent ob = new TerminatingEvent(terminatingEventNode);
                 IDManager.SetID(terminatingEventIDRef_, ob);
             }
             else if (terminatingEventNode.Attributes["href"] != null)
             {
                 terminatingEventIDRef_ = terminatingEventNode.Attributes["href"].Value;
             }
             else
             {
                 terminatingEvent_ = new TerminatingEvent(terminatingEventNode);
             }
         }
         else
         {
             terminatingEvent_ = new TerminatingEvent(terminatingEventNode);
         }
     }
     
 
     XmlNodeList partyTradeIdentifierNodeList = xmlNode.SelectNodes("partyTradeIdentifier");
     
     if (partyTradeIdentifierNodeList != null)
     {
         this.partyTradeIdentifier_ = new List<PartyTradeIdentifier>();
         foreach (XmlNode item in partyTradeIdentifierNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     partyTradeIdentifierIDRef_ = item.Attributes["id"].Value;
                     partyTradeIdentifier_.Add(new PartyTradeIdentifier(item));
                     IDManager.SetID(partyTradeIdentifierIDRef_, partyTradeIdentifier_[partyTradeIdentifier_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     partyTradeIdentifierIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 partyTradeIdentifier_.Add(new PartyTradeIdentifier(item));
                 }
             }
             else
             {
                 partyTradeIdentifier_.Add(new PartyTradeIdentifier(item));
             }
         }
     }
     
 
     XmlNodeList partyTradeInformationNodeList = xmlNode.SelectNodes("partyTradeInformation");
     
     if (partyTradeInformationNodeList != null)
     {
         this.partyTradeInformation_ = new List<PartyTradeInformation>();
         foreach (XmlNode item in partyTradeInformationNodeList)
         {
             if (item.Attributes["href"] != null || item.Attributes["id"] != null) 
             {
                 if (item.Attributes["id"] != null) 
                 {
                     partyTradeInformationIDRef_ = item.Attributes["id"].Value;
                     partyTradeInformation_.Add(new PartyTradeInformation(item));
                     IDManager.SetID(partyTradeInformationIDRef_, partyTradeInformation_[partyTradeInformation_.Count - 1 ]);
                 }
                 else if (item.Attributes["href"] != null)
                 {
                     partyTradeInformationIDRef_ = item.Attributes["href"].Value;
                 }
                 else
                 {
                 partyTradeInformation_.Add(new PartyTradeInformation(item));
                 }
             }
             else
             {
                 partyTradeInformation_.Add(new PartyTradeInformation(item));
             }
         }
     }
     
 
     XmlNode productTypeNode = xmlNode.SelectSingleNode("productType");
     
     if (productTypeNode != null)
     {
         if (productTypeNode.Attributes["href"] != null || productTypeNode.Attributes["id"] != null) 
         {
             if (productTypeNode.Attributes["id"] != null) 
             {
                 productTypeIDRef_ = productTypeNode.Attributes["id"].Value;
                 ProductType ob = new ProductType(productTypeNode);
                 IDManager.SetID(productTypeIDRef_, ob);
             }
             else if (productTypeNode.Attributes["href"] != null)
             {
                 productTypeIDRef_ = productTypeNode.Attributes["href"].Value;
             }
             else
             {
                 productType_ = new ProductType(productTypeNode);
             }
         }
         else
         {
             productType_ = new ProductType(productTypeNode);
         }
     }
     
 
     XmlNode productIdNode = xmlNode.SelectSingleNode("productId");
     
     if (productIdNode != null)
     {
         if (productIdNode.Attributes["href"] != null || productIdNode.Attributes["id"] != null) 
         {
             if (productIdNode.Attributes["id"] != null) 
             {
                 productIdIDRef_ = productIdNode.Attributes["id"].Value;
                 ProductId ob = new ProductId(productIdNode);
                 IDManager.SetID(productIdIDRef_, ob);
             }
             else if (productIdNode.Attributes["href"] != null)
             {
                 productIdIDRef_ = productIdNode.Attributes["href"].Value;
             }
             else
             {
                 productId_ = new ProductId(productIdNode);
             }
         }
         else
         {
             productId_ = new ProductId(productIdNode);
         }
     }
     
 
 }
        public TradeReferenceInformation(XmlNode xmlNode)
        {
            XmlNodeList originatingEventNodeList = xmlNode.SelectNodes("originatingEvent");

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

            foreach (XmlNode item in originatingEventNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        originatingEventIDRef = item.Attributes["id"].Name;
                        OriginatingEvent ob = OriginatingEvent();
                        IDManager.SetID(originatingEventIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        originatingEventIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        originatingEvent = new OriginatingEvent(item);
                    }
                }
            }


            XmlNodeList terminatingEventNodeList = xmlNode.SelectNodes("terminatingEvent");

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

            foreach (XmlNode item in terminatingEventNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        terminatingEventIDRef = item.Attributes["id"].Name;
                        TerminatingEvent ob = TerminatingEvent();
                        IDManager.SetID(terminatingEventIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        terminatingEventIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        terminatingEvent = new TerminatingEvent(item);
                    }
                }
            }


            XmlNodeList partyTradeIdentifierNodeList = xmlNode.SelectNodes("partyTradeIdentifier");

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


            XmlNodeList partyTradeInformationNodeList = xmlNode.SelectNodes("partyTradeInformation");

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


            XmlNodeList productTypeNodeList = xmlNode.SelectNodes("productType");

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

            foreach (XmlNode item in productTypeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        productTypeIDRef = item.Attributes["id"].Name;
                        ProductType ob = ProductType();
                        IDManager.SetID(productTypeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        productTypeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        productType = new ProductType(item);
                    }
                }
            }


            XmlNodeList productIdNodeList = xmlNode.SelectNodes("productId");

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

            foreach (XmlNode item in productIdNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        productIdIDRef = item.Attributes["id"].Name;
                        ProductId ob = ProductId();
                        IDManager.SetID(productIdIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        productIdIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        productId = new ProductId(item);
                    }
                }
            }
        }
        public TradeReferenceInformation(XmlNode xmlNode)
        {
            XmlNode originatingEventNode = xmlNode.SelectSingleNode("originatingEvent");

            if (originatingEventNode != null)
            {
                if (originatingEventNode.Attributes["href"] != null || originatingEventNode.Attributes["id"] != null)
                {
                    if (originatingEventNode.Attributes["id"] != null)
                    {
                        originatingEventIDRef_ = originatingEventNode.Attributes["id"].Value;
                        OriginatingEvent ob = new OriginatingEvent(originatingEventNode);
                        IDManager.SetID(originatingEventIDRef_, ob);
                    }
                    else if (originatingEventNode.Attributes["href"] != null)
                    {
                        originatingEventIDRef_ = originatingEventNode.Attributes["href"].Value;
                    }
                    else
                    {
                        originatingEvent_ = new OriginatingEvent(originatingEventNode);
                    }
                }
                else
                {
                    originatingEvent_ = new OriginatingEvent(originatingEventNode);
                }
            }


            XmlNode terminatingEventNode = xmlNode.SelectSingleNode("terminatingEvent");

            if (terminatingEventNode != null)
            {
                if (terminatingEventNode.Attributes["href"] != null || terminatingEventNode.Attributes["id"] != null)
                {
                    if (terminatingEventNode.Attributes["id"] != null)
                    {
                        terminatingEventIDRef_ = terminatingEventNode.Attributes["id"].Value;
                        TerminatingEvent ob = new TerminatingEvent(terminatingEventNode);
                        IDManager.SetID(terminatingEventIDRef_, ob);
                    }
                    else if (terminatingEventNode.Attributes["href"] != null)
                    {
                        terminatingEventIDRef_ = terminatingEventNode.Attributes["href"].Value;
                    }
                    else
                    {
                        terminatingEvent_ = new TerminatingEvent(terminatingEventNode);
                    }
                }
                else
                {
                    terminatingEvent_ = new TerminatingEvent(terminatingEventNode);
                }
            }


            XmlNodeList partyTradeIdentifierNodeList = xmlNode.SelectNodes("partyTradeIdentifier");

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


            XmlNodeList partyTradeInformationNodeList = xmlNode.SelectNodes("partyTradeInformation");

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


            XmlNode productTypeNode = xmlNode.SelectSingleNode("productType");

            if (productTypeNode != null)
            {
                if (productTypeNode.Attributes["href"] != null || productTypeNode.Attributes["id"] != null)
                {
                    if (productTypeNode.Attributes["id"] != null)
                    {
                        productTypeIDRef_ = productTypeNode.Attributes["id"].Value;
                        ProductType ob = new ProductType(productTypeNode);
                        IDManager.SetID(productTypeIDRef_, ob);
                    }
                    else if (productTypeNode.Attributes["href"] != null)
                    {
                        productTypeIDRef_ = productTypeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        productType_ = new ProductType(productTypeNode);
                    }
                }
                else
                {
                    productType_ = new ProductType(productTypeNode);
                }
            }


            XmlNode productIdNode = xmlNode.SelectSingleNode("productId");

            if (productIdNode != null)
            {
                if (productIdNode.Attributes["href"] != null || productIdNode.Attributes["id"] != null)
                {
                    if (productIdNode.Attributes["id"] != null)
                    {
                        productIdIDRef_ = productIdNode.Attributes["id"].Value;
                        ProductId ob = new ProductId(productIdNode);
                        IDManager.SetID(productIdIDRef_, ob);
                    }
                    else if (productIdNode.Attributes["href"] != null)
                    {
                        productIdIDRef_ = productIdNode.Attributes["href"].Value;
                    }
                    else
                    {
                        productId_ = new ProductId(productIdNode);
                    }
                }
                else
                {
                    productId_ = new ProductId(productIdNode);
                }
            }
        }