Que tal colegas : 
 
Mi pregunta es ¿¿¿ Como coloco el prefijo cfdi en cada uno de los nombres de nodos del XML ???  de tal forma que quede de la siguiente manera:
         <cfdi:DomicilioFiscal …… 
 
Les anexo parte del código en C# que desarrollé para generar el XML del CFD I
Lo unció que me falta es poner el prefijo cfdi a cada uno de los nodos
 
Me podrían explicar como realizarlo.
 
Gracias
Saludos
Halcón Divino 
Monterrey, Nuevo Loén, México
 
       #region Genera el XML
        string ArchivoXML = dsDatos.Tables[0].Rows[0]["eRFC"].ToString().Trim() + "_" + dsDatos.Tables[0].Rows[0]["SerieReferente"].ToString().Trim() + "_" + dsDatos.Tables[0].Rows[0]["FolioReferente"].ToString().Trim() + ".XML";
        XmlDeclaration CCDeclaracionXML;
        XmlNode nCFDI;
        XmlNode nEmisor;
        XmlNode neDomicilio;
        XmlNode nExpedido;
        XmlNode nReceptor;
        XmlNode nrDomicilio;
        XmlNode nConceptos;
        XmlNode nConcepto;
        XmlNode nImpuestos;
        XmlNode nRetenciones; 
        XmlNode nRetencion; 
        XmlNode nTrasladados; 
        XmlNode nTrasladado; 
 
        XmlDocument CCXml = new XmlDocument();
        CCDeclaracionXML = CCXml.CreateXmlDeclaration("1.0", "UTF-8", "");
 
        //Add the new node to the document.
        XmlElement root = CCXml.DocumentElement;
        CCXml.InsertBefore(CCDeclaracionXML, root);
 
 
        #region Se define el nodo Comprobante
        nCFDI = CCXml.CreateNode(XmlNodeType.Element, "Comprobante", "");
 
           //Se le Agrega atributos al nodo Comprobante 
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "xsi:schemaLocation","http://www.sat.gob.mx/cfd/3 cfdv3.xsd", "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "xmlns:cfdi"       , "http://www.sat.gob.mx/cfd/3", "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "xmlns:xsi"        , "http://www.w3.org/2001/XMLSchema-instance", "");
           AgregaAtributo("S", "N",ref CCXml, ref nCFDI, "version"          , "3.0", "");
           AgregaAtributo("N", "C",ref CCXml, ref nCFDI, "serie"            , dsDatos.Tables[0].Rows[0]["SerieReferente"].ToString(), "");
           AgregaAtributo("N", "N",ref CCXml, ref nCFDI, "folio"            , dsDatos.Tables[0].Rows[0]["FolioReferente"].ToString(), "");
           AgregaAtributo("S", "D",ref CCXml, ref nCFDI, "fecha"            , FormatYYYYMMDDTHHMMSS(dsDatos.Tables[0].Rows[0]["FechaHora"].ToString()), "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "formaDePago"      , dsDatos.Tables[0].Rows[0]["FormaDePago"].ToString(), "");
           AgregaAtributo("N", "C",ref CCXml, ref nCFDI, "condicionesDePago", dsDatos.Tables[0].Rows[0]["CondicionesDePago"].ToString(), "");
           AgregaAtributo("S", "$",ref CCXml, ref nCFDI, "subTotal"         , dsDatos.Tables[0].Rows[0]["Importe"].ToString(), "");
           AgregaAtributo("N", "$",ref CCXml, ref nCFDI, "descuento"        , dsDatos.Tables[0].Rows[0]["Descuento"].ToString(), "");
           AgregaAtributo("N", "C",ref CCXml, ref nCFDI, "motivoDescuento"  , dsDatos.Tables[0].Rows[0]["MotivoDescuento"].ToString(), "");
           AgregaAtributo("N", "$",ref CCXml, ref nCFDI, "TipoCambio"       , dsDatos.Tables[0].Rows[0]["Paridad"].ToString(), "");
           AgregaAtributo("N", "C",ref CCXml, ref nCFDI, "Moneda"           , dsDatos.Tables[0].Rows[0]["Moneda"].ToString(), "");
           AgregaAtributo("S", "$",ref CCXml, ref nCFDI, "total"            , dsDatos.Tables[0].Rows[0]["Total"].ToString(), "");
           AgregaAtributo("N", "C",ref CCXml, ref nCFDI, "metodoDePago"    , dsDatos.Tables[0].Rows[0]["MetodoDePago"].ToString(), "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "tipoDeComprobante", dsDatos.Tables[0].Rows[0]["TipoCFD"].ToString(), "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "sello"            , SelloDigital, "");
           AgregaAtributo("S", "N",ref CCXml, ref nCFDI, "noCertificado"    , noCertificado, "");
           AgregaAtributo("S", "C",ref CCXml, ref nCFDI, "certificado"      , Certificado, "");
 
           #region Se agrega el nodo EMISOR al nodo nCFDI
           nEmisor = CCXml.CreateNode(XmlNodeType.Element, "Emisor", "");
 
              AgregaAtributo("S","C",ref CCXml, ref nEmisor, "rfc"   , dsDatos.Tables[0].Rows[0]["eRFC"].ToString(), "");
              AgregaAtributo("S","C",ref CCXml, ref nEmisor, "nombre", dsDatos.Tables[0].Rows[0]["eNombre"].ToString(), "");
 
              neDomicilio = CCXml.CreateNode(XmlNodeType.Element, "DomicilioFiscal", "");
 
                 AgregaAtributo("S","C",ref CCXml, ref neDomicilio, "calle"       , dsDatos.Tables[0].Rows[0]["eDireccion"].ToString(), "");
                 AgregaAtributo("N","N",ref CCXml, ref neDomicilio, "noExterior"  , dsDatos.Tables[0].Rows[0]["eNumero"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref neDomicilio, "noInterior"  , dsDatos.Tables[0].Rows[0]["eInterior"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref neDomicilio, "colonia"     , dsDatos.Tables[0].Rows[0]["eColonia"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref neDomicilio, "localidad"   , dsDatos.Tables[0].Rows[0]["eLocalidad"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref neDomicilio, "referencia"  , dsDatos.Tables[0].Rows[0]["eReferencia"].ToString(), "");
                 AgregaAtributo("S","C",ref CCXml, ref neDomicilio, "municipio"   , dsDatos.Tables[0].Rows[0]["eMunicipio"].ToString(), "");
                 AgregaAtributo("S","C",ref CCXml, ref neDomicilio, "estado"      , dsDatos.Tables[0].Rows[0]["eEstado"].ToString(), "");
                 AgregaAtributo("S","C",ref CCXml, ref neDomicilio, "pais"        , dsDatos.Tables[0].Rows[0]["ePais"].ToString(), "");
                 AgregaAtributo("S","N",ref CCXml, ref neDomicilio, "codigoPostal", dsDatos.Tables[0].Rows[0]["eCP"].ToString(), "");
 
              nEmisor.AppendChild(neDomicilio);
 
              nExpedido = CCXml.CreateNode(XmlNodeType.Element, "ExpedidoEn", "");
 
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "calle"       , dsDatos.Tables[0].Rows[0]["xDireccion"].ToString(), "");
                 AgregaAtributo("N","N",ref CCXml, ref nExpedido, "noExterior"  , dsDatos.Tables[0].Rows[0]["xNumero"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "noInterior"  , dsDatos.Tables[0].Rows[0]["xInterior"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "colonia"     , dsDatos.Tables[0].Rows[0]["xColonia"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "localidad"   , dsDatos.Tables[0].Rows[0]["xLocalidad"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "municipio"   , dsDatos.Tables[0].Rows[0]["xMunicipio"].ToString(), "");
                 AgregaAtributo("N","C",ref CCXml, ref nExpedido, "estado"      , dsDatos.Tables[0].Rows[0]["xEstado"].ToString(), "");
                 AgregaAtributo("S","C",ref CCXml, ref nExpedido, "pais"        , dsDatos.Tables[0].Rows[0]["xPais"].ToString(), "");
                 AgregaAtributo("N","N",ref CCXml, ref nExpedido, "codigoPostal", dsDatos.Tables[0].Rows[0]["xCP"].ToString(), "");
 
              nEmisor.AppendChild(nExpedido);
 
           nCFDI.AppendChild(nEmisor);
           #endregion
 
           #region Se agrega el nodo RECEPTOR al nodo nCFDI
           nReceptor = CCXml.CreateNode(XmlNodeType.Element, "Receptor", "");
 
           AgregaAtributo("S", "C", ref CCXml, ref nReceptor, "rfc", dsDatos.Tables[0].Rows[0]["rRFC"].ToString(), "www.sat.gob.mx/cfd/3");
              AgregaAtributo("N","C",ref CCXml, ref nReceptor, "nombre", dsDatos.Tables[0].Rows[0]["rNombre"].ToString(), "");
 
              nrDomicilio = CCXml.CreateNode(XmlNodeType.Element, "Domicilio", "");
 
              nReceptor.AppendChild(nrDomicilio);
 
           nCFDI.AppendChild(nReceptor);
           #endregion
 
           #region Se agrega el nodo CONCEPTOS al nodo nCFDI
           nConceptos = CCXml.CreateNode(XmlNodeType.Element, "Conceptos", "");
 
 
           nCFDI.AppendChild(nConceptos);
           #endregion
 
           #region Se agrega el nodo IMPUESTOS al nodo nCFDI
           nImpuestos = CCXml.CreateNode(XmlNodeType.Element, "Impuestos", "");
 
              //Se agrega el nodo Trasladados al nodo Impuesto
               nTrasladados = CCXml.CreateNode(XmlNodeType.Element, "Traslados", "");
 
                 //Se agrega el nodo Retencion al nodo Retenciones
               nTrasladado = CCXml.CreateNode(XmlNodeType.Element, "Traslado", "");
                 AgregaAtributo("S", "C", ref CCXml, ref nTrasladado, "impuesto"  , dsDatos.Tables[0].Rows[0]["rLeyendaIVA"].ToString(), "");
                 AgregaAtributo("S", "$",ref CCXml, ref nTrasladado, "tasa"        , dsDatos.Tables[0].Rows[0]["rTasaIVA"].ToString(), "");
                 AgregaAtributo("S", "$",ref CCXml, ref nTrasladado, "importe"     , dsDatos.Tables[0].Rows[0]["rImpuestoIVA"].ToString(), "");
                 nTrasladados.AppendChild(nTrasladado);
 
              nImpuestos.AppendChild(nTrasladados);
 
 
           nCFDI.AppendChild(nImpuestos);
           #endregion
 
           //Se le Agrega al nodo Comprobante al XML 
        CCXml.AppendChild(nCFDI);
        #endregion
 
        CCXml.Save(RutaXML + ArchivoXML);
        #endregion XML 
   
 



 Este tema le ha gustado a 1 personas
Este tema le ha gustado a 1 personas