public PositionHistory(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 tradeNode = xmlNode.SelectSingleNode("trade");

            if (tradeNode != null)
            {
                if (tradeNode.Attributes["href"] != null || tradeNode.Attributes["id"] != null)
                {
                    if (tradeNode.Attributes["id"] != null)
                    {
                        tradeIDRef_ = tradeNode.Attributes["id"].Value;
                        Trade ob = new Trade(tradeNode);
                        IDManager.SetID(tradeIDRef_, ob);
                    }
                    else if (tradeNode.Attributes["href"] != null)
                    {
                        tradeIDRef_ = tradeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        trade_ = new Trade(tradeNode);
                    }
                }
                else
                {
                    trade_ = new Trade(tradeNode);
                }
            }


            XmlNode amendmentNode = xmlNode.SelectSingleNode("amendment");

            if (amendmentNode != null)
            {
                if (amendmentNode.Attributes["href"] != null || amendmentNode.Attributes["id"] != null)
                {
                    if (amendmentNode.Attributes["id"] != null)
                    {
                        amendmentIDRef_ = amendmentNode.Attributes["id"].Value;
                        TradeAmendmentContent ob = new TradeAmendmentContent(amendmentNode);
                        IDManager.SetID(amendmentIDRef_, ob);
                    }
                    else if (amendmentNode.Attributes["href"] != null)
                    {
                        amendmentIDRef_ = amendmentNode.Attributes["href"].Value;
                    }
                    else
                    {
                        amendment_ = new TradeAmendmentContent(amendmentNode);
                    }
                }
                else
                {
                    amendment_ = new TradeAmendmentContent(amendmentNode);
                }
            }


            XmlNode increaseNode = xmlNode.SelectSingleNode("increase");

            if (increaseNode != null)
            {
                if (increaseNode.Attributes["href"] != null || increaseNode.Attributes["id"] != null)
                {
                    if (increaseNode.Attributes["id"] != null)
                    {
                        increaseIDRef_ = increaseNode.Attributes["id"].Value;
                        TradeNotionalChange ob = new TradeNotionalChange(increaseNode);
                        IDManager.SetID(increaseIDRef_, ob);
                    }
                    else if (increaseNode.Attributes["href"] != null)
                    {
                        increaseIDRef_ = increaseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        increase_ = new TradeNotionalChange(increaseNode);
                    }
                }
                else
                {
                    increase_ = new TradeNotionalChange(increaseNode);
                }
            }


            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);
                }
            }


            XmlNode terminationNode = xmlNode.SelectSingleNode("termination");

            if (terminationNode != null)
            {
                if (terminationNode.Attributes["href"] != null || terminationNode.Attributes["id"] != null)
                {
                    if (terminationNode.Attributes["id"] != null)
                    {
                        terminationIDRef_ = terminationNode.Attributes["id"].Value;
                        TradeNotionalChange ob = new TradeNotionalChange(terminationNode);
                        IDManager.SetID(terminationIDRef_, ob);
                    }
                    else if (terminationNode.Attributes["href"] != null)
                    {
                        terminationIDRef_ = terminationNode.Attributes["href"].Value;
                    }
                    else
                    {
                        termination_ = new TradeNotionalChange(terminationNode);
                    }
                }
                else
                {
                    termination_ = new TradeNotionalChange(terminationNode);
                }
            }


            XmlNode novationNode = xmlNode.SelectSingleNode("novation");

            if (novationNode != null)
            {
                if (novationNode.Attributes["href"] != null || novationNode.Attributes["id"] != null)
                {
                    if (novationNode.Attributes["id"] != null)
                    {
                        novationIDRef_ = novationNode.Attributes["id"].Value;
                        TradeNovationContent ob = new TradeNovationContent(novationNode);
                        IDManager.SetID(novationIDRef_, ob);
                    }
                    else if (novationNode.Attributes["href"] != null)
                    {
                        novationIDRef_ = novationNode.Attributes["href"].Value;
                    }
                    else
                    {
                        novation_ = new TradeNovationContent(novationNode);
                    }
                }
                else
                {
                    novation_ = new TradeNovationContent(novationNode);
                }
            }


            XmlNode optionExerciseNode = xmlNode.SelectSingleNode("optionExercise");

            if (optionExerciseNode != null)
            {
                if (optionExerciseNode.Attributes["href"] != null || optionExerciseNode.Attributes["id"] != null)
                {
                    if (optionExerciseNode.Attributes["id"] != null)
                    {
                        optionExerciseIDRef_ = optionExerciseNode.Attributes["id"].Value;
                        OptionExercise ob = new OptionExercise(optionExerciseNode);
                        IDManager.SetID(optionExerciseIDRef_, ob);
                    }
                    else if (optionExerciseNode.Attributes["href"] != null)
                    {
                        optionExerciseIDRef_ = optionExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        optionExercise_ = new OptionExercise(optionExerciseNode);
                    }
                }
                else
                {
                    optionExercise_ = new OptionExercise(optionExerciseNode);
                }
            }


            XmlNodeList optionExpiryNodeList = xmlNode.SelectNodes("optionExpiry");

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


            XmlNode deClearNode = xmlNode.SelectSingleNode("deClear");

            if (deClearNode != null)
            {
                if (deClearNode.Attributes["href"] != null || deClearNode.Attributes["id"] != null)
                {
                    if (deClearNode.Attributes["id"] != null)
                    {
                        deClearIDRef_ = deClearNode.Attributes["id"].Value;
                        DeClear ob = new DeClear(deClearNode);
                        IDManager.SetID(deClearIDRef_, ob);
                    }
                    else if (deClearNode.Attributes["href"] != null)
                    {
                        deClearIDRef_ = deClearNode.Attributes["href"].Value;
                    }
                    else
                    {
                        deClear_ = new DeClear(deClearNode);
                    }
                }
                else
                {
                    deClear_ = new DeClear(deClearNode);
                }
            }


            XmlNode withdrawalNode = xmlNode.SelectSingleNode("withdrawal");

            if (withdrawalNode != null)
            {
                if (withdrawalNode.Attributes["href"] != null || withdrawalNode.Attributes["id"] != null)
                {
                    if (withdrawalNode.Attributes["id"] != null)
                    {
                        withdrawalIDRef_ = withdrawalNode.Attributes["id"].Value;
                        Withdrawal ob = new Withdrawal(withdrawalNode);
                        IDManager.SetID(withdrawalIDRef_, ob);
                    }
                    else if (withdrawalNode.Attributes["href"] != null)
                    {
                        withdrawalIDRef_ = withdrawalNode.Attributes["href"].Value;
                    }
                    else
                    {
                        withdrawal_ = new Withdrawal(withdrawalNode);
                    }
                }
                else
                {
                    withdrawal_ = new Withdrawal(withdrawalNode);
                }
            }


            XmlNode additionalEventNode = xmlNode.SelectSingleNode("additionalEvent");

            if (additionalEventNode != null)
            {
                if (additionalEventNode.Attributes["href"] != null || additionalEventNode.Attributes["id"] != null)
                {
                    if (additionalEventNode.Attributes["id"] != null)
                    {
                        additionalEventIDRef_ = additionalEventNode.Attributes["id"].Value;
                        AdditionalEvent ob = new AdditionalEvent(additionalEventNode);
                        IDManager.SetID(additionalEventIDRef_, ob);
                    }
                    else if (additionalEventNode.Attributes["href"] != null)
                    {
                        additionalEventIDRef_ = additionalEventNode.Attributes["href"].Value;
                    }
                    else
                    {
                        additionalEvent_ = new AdditionalEvent(additionalEventNode);
                    }
                }
                else
                {
                    additionalEvent_ = new AdditionalEvent(additionalEventNode);
                }
            }
        }
        public ExecutionAdvice(XmlNode xmlNode)
            : base(xmlNode)
        {
            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 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 tradeNodeList = xmlNode.SelectNodes("trade");

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

            foreach (XmlNode item in tradeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        tradeIDRef = item.Attributes["id"].Name;
                        Trade ob = Trade();
                        IDManager.SetID(tradeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        tradeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        trade = new Trade(item);
                    }
                }
            }


            XmlNodeList amendmentNodeList = xmlNode.SelectNodes("amendment");

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

            foreach (XmlNode item in amendmentNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        amendmentIDRef = item.Attributes["id"].Name;
                        TradeAmendmentContent ob = TradeAmendmentContent();
                        IDManager.SetID(amendmentIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        amendmentIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        amendment = new TradeAmendmentContent(item);
                    }
                }
            }


            XmlNodeList increaseNodeList = xmlNode.SelectNodes("increase");

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

            foreach (XmlNode item in increaseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        increaseIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(increaseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        increaseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        increase = new TradeNotionalChange(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 terminationNodeList = xmlNode.SelectNodes("termination");

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

            foreach (XmlNode item in terminationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        terminationIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(terminationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        terminationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        termination = new TradeNotionalChange(item);
                    }
                }
            }


            XmlNodeList novationNodeList = xmlNode.SelectNodes("novation");

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

            foreach (XmlNode item in novationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        novationIDRef = item.Attributes["id"].Name;
                        TradeNovationContent ob = TradeNovationContent();
                        IDManager.SetID(novationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        novationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        novation = new TradeNovationContent(item);
                    }
                }
            }


            XmlNodeList optionExerciseNodeList = xmlNode.SelectNodes("optionExercise");

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

            foreach (XmlNode item in optionExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        optionExerciseIDRef = item.Attributes["id"].Name;
                        OptionExercise ob = OptionExercise();
                        IDManager.SetID(optionExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        optionExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        optionExercise = new OptionExercise(item);
                    }
                }
            }


            XmlNodeList optionExpiryNodeList = xmlNode.SelectNodes("optionExpiry");

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


            XmlNodeList deClearNodeList = xmlNode.SelectNodes("deClear");

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

            foreach (XmlNode item in deClearNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        deClearIDRef = item.Attributes["id"].Name;
                        DeClear ob = DeClear();
                        IDManager.SetID(deClearIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        deClearIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        deClear = new DeClear(item);
                    }
                }
            }


            XmlNodeList withdrawalNodeList = xmlNode.SelectNodes("withdrawal");

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

            foreach (XmlNode item in withdrawalNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        withdrawalIDRef = item.Attributes["id"].Name;
                        Withdrawal ob = Withdrawal();
                        IDManager.SetID(withdrawalIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        withdrawalIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        withdrawal = new Withdrawal(item);
                    }
                }
            }


            XmlNodeList additionalEventNodeList = xmlNode.SelectNodes("additionalEvent");

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

            foreach (XmlNode item in additionalEventNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        additionalEventIDRef = item.Attributes["id"].Name;
                        AdditionalEvent ob = AdditionalEvent();
                        IDManager.SetID(additionalEventIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        additionalEventIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        additionalEvent = new AdditionalEvent(item);
                    }
                }
            }


            XmlNodeList quoteNodeList = xmlNode.SelectNodes("quote");

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


            XmlNodeList paymentDetailsNodeList = xmlNode.SelectNodes("paymentDetails");

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


            XmlNodeList partyNodeList = xmlNode.SelectNodes("party");

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


            XmlNodeList accountNodeList = xmlNode.SelectNodes("account");

            foreach (XmlNode item in accountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        accountIDRef = item.Attributes["id"].Name;
                        List <Account> ob = new List <Account>();
                        ob.Add(new Account(item));
                        IDManager.SetID(accountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        accountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        account.Add(new Account(item));
                    }
                }
            }
        }
示例#3
0
        public RequestConsent(XmlNode xmlNode)
            : base(xmlNode)
        {
            XmlNodeList requestedActionNodeList = xmlNode.SelectNodes("requestedAction");

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

            foreach (XmlNode item in requestedActionNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        requestedActionIDRef = item.Attributes["id"].Name;
                        RequestedAction ob = RequestedAction();
                        IDManager.SetID(requestedActionIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        requestedActionIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        requestedAction = new RequestedAction(item);
                    }
                }
            }


            XmlNodeList portfolioReferenceNodeList = xmlNode.SelectNodes("portfolioReference");

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

            foreach (XmlNode item in portfolioReferenceNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        portfolioReferenceIDRef = item.Attributes["id"].Name;
                        PortfolioReference ob = PortfolioReference();
                        IDManager.SetID(portfolioReferenceIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        portfolioReferenceIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        portfolioReference = new PortfolioReference(item);
                    }
                }
            }


            XmlNodeList compressionActivityNodeList = xmlNode.SelectNodes("compressionActivity");

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

            foreach (XmlNode item in compressionActivityNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        compressionActivityIDRef = item.Attributes["id"].Name;
                        CompressionActivity ob = CompressionActivity();
                        IDManager.SetID(compressionActivityIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        compressionActivityIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        compressionActivity = new CompressionActivity(item);
                    }
                }
            }


            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 tradeNodeList = xmlNode.SelectNodes("trade");

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

            foreach (XmlNode item in tradeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        tradeIDRef = item.Attributes["id"].Name;
                        Trade ob = Trade();
                        IDManager.SetID(tradeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        tradeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        trade = new Trade(item);
                    }
                }
            }


            XmlNodeList amendmentNodeList = xmlNode.SelectNodes("amendment");

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

            foreach (XmlNode item in amendmentNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        amendmentIDRef = item.Attributes["id"].Name;
                        TradeAmendmentContent ob = TradeAmendmentContent();
                        IDManager.SetID(amendmentIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        amendmentIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        amendment = new TradeAmendmentContent(item);
                    }
                }
            }


            XmlNodeList increaseNodeList = xmlNode.SelectNodes("increase");

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

            foreach (XmlNode item in increaseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        increaseIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(increaseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        increaseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        increase = new TradeNotionalChange(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 terminationNodeList = xmlNode.SelectNodes("termination");

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

            foreach (XmlNode item in terminationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        terminationIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(terminationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        terminationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        termination = new TradeNotionalChange(item);
                    }
                }
            }


            XmlNodeList novationNodeList = xmlNode.SelectNodes("novation");

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

            foreach (XmlNode item in novationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        novationIDRef = item.Attributes["id"].Name;
                        TradeNovationContent ob = TradeNovationContent();
                        IDManager.SetID(novationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        novationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        novation = new TradeNovationContent(item);
                    }
                }
            }


            XmlNodeList optionExerciseNodeList = xmlNode.SelectNodes("optionExercise");

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

            foreach (XmlNode item in optionExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        optionExerciseIDRef = item.Attributes["id"].Name;
                        OptionExercise ob = OptionExercise();
                        IDManager.SetID(optionExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        optionExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        optionExercise = new OptionExercise(item);
                    }
                }
            }


            XmlNodeList optionExpiryNodeList = xmlNode.SelectNodes("optionExpiry");

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


            XmlNodeList deClearNodeList = xmlNode.SelectNodes("deClear");

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

            foreach (XmlNode item in deClearNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        deClearIDRef = item.Attributes["id"].Name;
                        DeClear ob = DeClear();
                        IDManager.SetID(deClearIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        deClearIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        deClear = new DeClear(item);
                    }
                }
            }


            XmlNodeList withdrawalNodeList = xmlNode.SelectNodes("withdrawal");

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

            foreach (XmlNode item in withdrawalNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        withdrawalIDRef = item.Attributes["id"].Name;
                        Withdrawal ob = Withdrawal();
                        IDManager.SetID(withdrawalIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        withdrawalIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        withdrawal = new Withdrawal(item);
                    }
                }
            }


            XmlNodeList additionalEventNodeList = xmlNode.SelectNodes("additionalEvent");

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

            foreach (XmlNode item in additionalEventNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        additionalEventIDRef = item.Attributes["id"].Name;
                        AdditionalEvent ob = AdditionalEvent();
                        IDManager.SetID(additionalEventIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        additionalEventIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        additionalEvent = new AdditionalEvent(item);
                    }
                }
            }


            XmlNodeList quoteNodeList = xmlNode.SelectNodes("quote");

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


            XmlNodeList partyNodeList = xmlNode.SelectNodes("party");

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


            XmlNodeList accountNodeList = xmlNode.SelectNodes("account");

            foreach (XmlNode item in accountNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        accountIDRef = item.Attributes["id"].Name;
                        List <Account> ob = new List <Account>();
                        ob.Add(new Account(item));
                        IDManager.SetID(accountIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        accountIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        account.Add(new Account(item));
                    }
                }
            }
        }
示例#4
0
        public ExecutionNotification(XmlNode xmlNode)
            : base(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 tradeNode = xmlNode.SelectSingleNode("trade");

            if (tradeNode != null)
            {
                if (tradeNode.Attributes["href"] != null || tradeNode.Attributes["id"] != null)
                {
                    if (tradeNode.Attributes["id"] != null)
                    {
                        tradeIDRef_ = tradeNode.Attributes["id"].Value;
                        Trade ob = new Trade(tradeNode);
                        IDManager.SetID(tradeIDRef_, ob);
                    }
                    else if (tradeNode.Attributes["href"] != null)
                    {
                        tradeIDRef_ = tradeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        trade_ = new Trade(tradeNode);
                    }
                }
                else
                {
                    trade_ = new Trade(tradeNode);
                }
            }


            XmlNode amendmentNode = xmlNode.SelectSingleNode("amendment");

            if (amendmentNode != null)
            {
                if (amendmentNode.Attributes["href"] != null || amendmentNode.Attributes["id"] != null)
                {
                    if (amendmentNode.Attributes["id"] != null)
                    {
                        amendmentIDRef_ = amendmentNode.Attributes["id"].Value;
                        TradeAmendmentContent ob = new TradeAmendmentContent(amendmentNode);
                        IDManager.SetID(amendmentIDRef_, ob);
                    }
                    else if (amendmentNode.Attributes["href"] != null)
                    {
                        amendmentIDRef_ = amendmentNode.Attributes["href"].Value;
                    }
                    else
                    {
                        amendment_ = new TradeAmendmentContent(amendmentNode);
                    }
                }
                else
                {
                    amendment_ = new TradeAmendmentContent(amendmentNode);
                }
            }


            XmlNode increaseNode = xmlNode.SelectSingleNode("increase");

            if (increaseNode != null)
            {
                if (increaseNode.Attributes["href"] != null || increaseNode.Attributes["id"] != null)
                {
                    if (increaseNode.Attributes["id"] != null)
                    {
                        increaseIDRef_ = increaseNode.Attributes["id"].Value;
                        TradeNotionalChange ob = new TradeNotionalChange(increaseNode);
                        IDManager.SetID(increaseIDRef_, ob);
                    }
                    else if (increaseNode.Attributes["href"] != null)
                    {
                        increaseIDRef_ = increaseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        increase_ = new TradeNotionalChange(increaseNode);
                    }
                }
                else
                {
                    increase_ = new TradeNotionalChange(increaseNode);
                }
            }


            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);
                }
            }


            XmlNode terminationNode = xmlNode.SelectSingleNode("termination");

            if (terminationNode != null)
            {
                if (terminationNode.Attributes["href"] != null || terminationNode.Attributes["id"] != null)
                {
                    if (terminationNode.Attributes["id"] != null)
                    {
                        terminationIDRef_ = terminationNode.Attributes["id"].Value;
                        TradeNotionalChange ob = new TradeNotionalChange(terminationNode);
                        IDManager.SetID(terminationIDRef_, ob);
                    }
                    else if (terminationNode.Attributes["href"] != null)
                    {
                        terminationIDRef_ = terminationNode.Attributes["href"].Value;
                    }
                    else
                    {
                        termination_ = new TradeNotionalChange(terminationNode);
                    }
                }
                else
                {
                    termination_ = new TradeNotionalChange(terminationNode);
                }
            }


            XmlNode novationNode = xmlNode.SelectSingleNode("novation");

            if (novationNode != null)
            {
                if (novationNode.Attributes["href"] != null || novationNode.Attributes["id"] != null)
                {
                    if (novationNode.Attributes["id"] != null)
                    {
                        novationIDRef_ = novationNode.Attributes["id"].Value;
                        TradeNovationContent ob = new TradeNovationContent(novationNode);
                        IDManager.SetID(novationIDRef_, ob);
                    }
                    else if (novationNode.Attributes["href"] != null)
                    {
                        novationIDRef_ = novationNode.Attributes["href"].Value;
                    }
                    else
                    {
                        novation_ = new TradeNovationContent(novationNode);
                    }
                }
                else
                {
                    novation_ = new TradeNovationContent(novationNode);
                }
            }


            XmlNode optionExerciseNode = xmlNode.SelectSingleNode("optionExercise");

            if (optionExerciseNode != null)
            {
                if (optionExerciseNode.Attributes["href"] != null || optionExerciseNode.Attributes["id"] != null)
                {
                    if (optionExerciseNode.Attributes["id"] != null)
                    {
                        optionExerciseIDRef_ = optionExerciseNode.Attributes["id"].Value;
                        OptionExercise ob = new OptionExercise(optionExerciseNode);
                        IDManager.SetID(optionExerciseIDRef_, ob);
                    }
                    else if (optionExerciseNode.Attributes["href"] != null)
                    {
                        optionExerciseIDRef_ = optionExerciseNode.Attributes["href"].Value;
                    }
                    else
                    {
                        optionExercise_ = new OptionExercise(optionExerciseNode);
                    }
                }
                else
                {
                    optionExercise_ = new OptionExercise(optionExerciseNode);
                }
            }


            XmlNodeList optionExpiryNodeList = xmlNode.SelectNodes("optionExpiry");

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


            XmlNode deClearNode = xmlNode.SelectSingleNode("deClear");

            if (deClearNode != null)
            {
                if (deClearNode.Attributes["href"] != null || deClearNode.Attributes["id"] != null)
                {
                    if (deClearNode.Attributes["id"] != null)
                    {
                        deClearIDRef_ = deClearNode.Attributes["id"].Value;
                        DeClear ob = new DeClear(deClearNode);
                        IDManager.SetID(deClearIDRef_, ob);
                    }
                    else if (deClearNode.Attributes["href"] != null)
                    {
                        deClearIDRef_ = deClearNode.Attributes["href"].Value;
                    }
                    else
                    {
                        deClear_ = new DeClear(deClearNode);
                    }
                }
                else
                {
                    deClear_ = new DeClear(deClearNode);
                }
            }


            XmlNode withdrawalNode = xmlNode.SelectSingleNode("withdrawal");

            if (withdrawalNode != null)
            {
                if (withdrawalNode.Attributes["href"] != null || withdrawalNode.Attributes["id"] != null)
                {
                    if (withdrawalNode.Attributes["id"] != null)
                    {
                        withdrawalIDRef_ = withdrawalNode.Attributes["id"].Value;
                        Withdrawal ob = new Withdrawal(withdrawalNode);
                        IDManager.SetID(withdrawalIDRef_, ob);
                    }
                    else if (withdrawalNode.Attributes["href"] != null)
                    {
                        withdrawalIDRef_ = withdrawalNode.Attributes["href"].Value;
                    }
                    else
                    {
                        withdrawal_ = new Withdrawal(withdrawalNode);
                    }
                }
                else
                {
                    withdrawal_ = new Withdrawal(withdrawalNode);
                }
            }


            XmlNode additionalEventNode = xmlNode.SelectSingleNode("additionalEvent");

            if (additionalEventNode != null)
            {
                if (additionalEventNode.Attributes["href"] != null || additionalEventNode.Attributes["id"] != null)
                {
                    if (additionalEventNode.Attributes["id"] != null)
                    {
                        additionalEventIDRef_ = additionalEventNode.Attributes["id"].Value;
                        AdditionalEvent ob = new AdditionalEvent(additionalEventNode);
                        IDManager.SetID(additionalEventIDRef_, ob);
                    }
                    else if (additionalEventNode.Attributes["href"] != null)
                    {
                        additionalEventIDRef_ = additionalEventNode.Attributes["href"].Value;
                    }
                    else
                    {
                        additionalEvent_ = new AdditionalEvent(additionalEventNode);
                    }
                }
                else
                {
                    additionalEvent_ = new AdditionalEvent(additionalEventNode);
                }
            }


            XmlNodeList quoteNodeList = xmlNode.SelectNodes("quote");

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


            XmlNodeList partyNodeList = xmlNode.SelectNodes("party");

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


            XmlNodeList accountNodeList = xmlNode.SelectNodes("account");

            if (accountNodeList != null)
            {
                this.account_ = new List <Account>();
                foreach (XmlNode item in accountNodeList)
                {
                    if (item.Attributes["href"] != null || item.Attributes["id"] != null)
                    {
                        if (item.Attributes["id"] != null)
                        {
                            accountIDRef_ = item.Attributes["id"].Value;
                            account_.Add(new Account(item));
                            IDManager.SetID(accountIDRef_, account_[account_.Count - 1]);
                        }
                        else if (item.Attributes["href"] != null)
                        {
                            accountIDRef_ = item.Attributes["href"].Value;
                        }
                        else
                        {
                            account_.Add(new Account(item));
                        }
                    }
                    else
                    {
                        account_.Add(new Account(item));
                    }
                }
            }
        }
        public PositionHistory(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 tradeNodeList = xmlNode.SelectNodes("trade");

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

            foreach (XmlNode item in tradeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        tradeIDRef = item.Attributes["id"].Name;
                        Trade ob = Trade();
                        IDManager.SetID(tradeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        tradeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        trade = new Trade(item);
                    }
                }
            }


            XmlNodeList amendmentNodeList = xmlNode.SelectNodes("amendment");

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

            foreach (XmlNode item in amendmentNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        amendmentIDRef = item.Attributes["id"].Name;
                        TradeAmendmentContent ob = TradeAmendmentContent();
                        IDManager.SetID(amendmentIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        amendmentIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        amendment = new TradeAmendmentContent(item);
                    }
                }
            }


            XmlNodeList increaseNodeList = xmlNode.SelectNodes("increase");

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

            foreach (XmlNode item in increaseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        increaseIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(increaseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        increaseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        increase = new TradeNotionalChange(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 terminationNodeList = xmlNode.SelectNodes("termination");

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

            foreach (XmlNode item in terminationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        terminationIDRef = item.Attributes["id"].Name;
                        TradeNotionalChange ob = TradeNotionalChange();
                        IDManager.SetID(terminationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        terminationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        termination = new TradeNotionalChange(item);
                    }
                }
            }


            XmlNodeList novationNodeList = xmlNode.SelectNodes("novation");

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

            foreach (XmlNode item in novationNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        novationIDRef = item.Attributes["id"].Name;
                        TradeNovationContent ob = TradeNovationContent();
                        IDManager.SetID(novationIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        novationIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        novation = new TradeNovationContent(item);
                    }
                }
            }


            XmlNodeList optionExerciseNodeList = xmlNode.SelectNodes("optionExercise");

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

            foreach (XmlNode item in optionExerciseNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        optionExerciseIDRef = item.Attributes["id"].Name;
                        OptionExercise ob = OptionExercise();
                        IDManager.SetID(optionExerciseIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        optionExerciseIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        optionExercise = new OptionExercise(item);
                    }
                }
            }


            XmlNodeList optionExpiryNodeList = xmlNode.SelectNodes("optionExpiry");

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


            XmlNodeList deClearNodeList = xmlNode.SelectNodes("deClear");

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

            foreach (XmlNode item in deClearNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        deClearIDRef = item.Attributes["id"].Name;
                        DeClear ob = DeClear();
                        IDManager.SetID(deClearIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        deClearIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        deClear = new DeClear(item);
                    }
                }
            }


            XmlNodeList withdrawalNodeList = xmlNode.SelectNodes("withdrawal");

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

            foreach (XmlNode item in withdrawalNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        withdrawalIDRef = item.Attributes["id"].Name;
                        Withdrawal ob = Withdrawal();
                        IDManager.SetID(withdrawalIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        withdrawalIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        withdrawal = new Withdrawal(item);
                    }
                }
            }


            XmlNodeList additionalEventNodeList = xmlNode.SelectNodes("additionalEvent");

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

            foreach (XmlNode item in additionalEventNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        additionalEventIDRef = item.Attributes["id"].Name;
                        AdditionalEvent ob = AdditionalEvent();
                        IDManager.SetID(additionalEventIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        additionalEventIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        additionalEvent = new AdditionalEvent(item);
                    }
                }
            }
        }