Пример #1
0
        public belDest xmlBuscaDest()
        {
            XmlDocument xDest      = new XmlDocument();
            belDest     objDest    = new belDest();
            XmlDocument xEnderDest = new XmlDocument();

            try
            {
                xDest.LoadXml(xDoc.GetElementsByTagName("dest")[0].OuterXml);

                objDest.Cnpj  = xDest.GetElementsByTagName("CNPJ")[0].InnerText;
                objDest.Xnome = xDest.GetElementsByTagName("xNome")[0].InnerText;

                xEnderDest.LoadXml(xDest.GetElementsByTagName("enderDest")[0].OuterXml);
                objDest.Xlgr    = xEnderDest.GetElementsByTagName("xLgr")[0].InnerText;
                objDest.Nro     = xEnderDest.GetElementsByTagName("nro")[0].InnerText;
                objDest.Xbairro = xEnderDest.GetElementsByTagName("xBairro")[0].InnerText;
                objDest.Cmun    = xEnderDest.GetElementsByTagName("cMun")[0].InnerText;
                objDest.Xmun    = xEnderDest.GetElementsByTagName("cMun")[0].InnerText;
                objDest.Uf      = xEnderDest.GetElementsByTagName("UF")[0].InnerText;
                objDest.Cep     = xEnderDest.GetElementsByTagName("CEP")[0].InnerText;
                objDest.Cpais   = xEnderDest.GetElementsByTagName("cPais")[0].InnerText;
                objDest.Xpais   = xEnderDest.GetElementsByTagName("xPais")[0].InnerText;
                objDest.Fone    = xEnderDest.GetElementsByTagName("fone")[0].InnerText;

                objDest.Ie = xDest.GetElementsByTagName("IE")[0].InnerText;
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Problemas lendo a Tag Destinatário, Erro.: {0}",
                                                  ex.Message));
            }

            return(objDest);
        }
Пример #2
0
        public belDest xmlBuscaDest()
        {
            XmlDocument xDest = new XmlDocument();
            belDest objDest = new belDest();
            XmlDocument xEnderDest = new XmlDocument();

            try
            {
                xDest.LoadXml(xDoc.GetElementsByTagName("dest")[0].OuterXml);

                objDest.Cnpj = xDest.GetElementsByTagName("CNPJ")[0].InnerText;
                objDest.Xnome = xDest.GetElementsByTagName("xNome")[0].InnerText;

                xEnderDest.LoadXml(xDest.GetElementsByTagName("enderDest")[0].OuterXml);
                objDest.Xlgr = xEnderDest.GetElementsByTagName("xLgr")[0].InnerText;
                objDest.Nro = xEnderDest.GetElementsByTagName("nro")[0].InnerText;
                objDest.Xbairro = xEnderDest.GetElementsByTagName("xBairro")[0].InnerText;
                objDest.Cmun = xEnderDest.GetElementsByTagName("cMun")[0].InnerText;
                objDest.Xmun = xEnderDest.GetElementsByTagName("cMun")[0].InnerText;
                objDest.Uf = xEnderDest.GetElementsByTagName("UF")[0].InnerText;
                objDest.Cep = xEnderDest.GetElementsByTagName("CEP")[0].InnerText;
                objDest.Cpais = xEnderDest.GetElementsByTagName("cPais")[0].InnerText;
                objDest.Xpais = xEnderDest.GetElementsByTagName("xPais")[0].InnerText;
                objDest.Fone = xEnderDest.GetElementsByTagName("fone")[0].InnerText;

                objDest.Ie = xDest.GetElementsByTagName("IE")[0].InnerText;

            }
            catch (Exception ex)
            {

                throw new Exception(string.Format("Problemas lendo a Tag Destinatário, Erro.: {0}",
                                                  ex.Message));
            }

            return objDest;

        }