He revisado y solo mantuve el código de lectura del XMLDocument, que fue lo que inicialmente implementé y me dio errores.
Lo dicho, mucho mas seguro y sencillo evitar esa dependencia con código del tipo:
Código Delphi
[-]
Writeln(FN34,'<?xml version="1.0" encoding="UTF-8"?>');
Writeln(FN34,'<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:iso:std:iso:20022:tech:xsdain.001.001.03">');
Writeln(FN34,' <CstmrCdtTrfInitn>');
Writeln(FN34,' <GrpHdr>');
Writeln(FN34,' <CstmrCdtTrfInitn>');
Writeln(FN34,' <GrpHdr>');
Writeln(FN34,' <PstlAdr>');
SetCampo(' ','PstCd', Copy(LimpiarCarNormaSEPAXML(cdsEmisorCOD_POSTAL.Value),1,16), false);
SetCampo(' ','TwnNm', Copy(LimpiarCarNormaSEPAXML(cdsEmisorCIUDAD.Value),1,35), false);
SetCampo(' ','CtrySubDvsn', Copy(LimpiarCarNormaSEPAXML(cdsEmisorPROVINCIA.Value),1,35), false);
if cdsEmisorID_PAIS.Value <> '' then
SetCampo(' ','Ctry', cdsEmisorID_PAIS.Value, true)
else
SetCampo(' ','Ctry', 'ES', true);
SetCampo(' ','AdrLine', Copy(LimpiarCarNormaSEPAXML(cdsEmisorDOMICILIO.Value),1,70), false);
Writeln(FN34,' </PstlAdr>');
cdsDatos.First;
while not cdsDatos.EOF do
begin
Writeln(FN34,' <CdtTrfTxInf>');
Writeln(FN34,' <PmtId>');
Writeln(FN34,' <Amt>');
Writeln(FN34,' <InstdAmt Ccy="EUR">' + importe_t +'</InstdAmt>');
Writeln(FN34,' </Amt>');
if (cdsDatosBIC.Value <> '') or (cdsDatosL_ENTIDAD_BIC.Value <> '') then
begin
Writeln(FN34,' <CdtrAgt>');
Writeln(FN34,' <FinInstnId>');
if (cdsDatosBIC.Value <> '') then
SetCampo(' ','BIC', cdsDatosBIC.Value, false)
else
SetCampo(' ','BIC', cdsDatosL_ENTIDAD_BIC.Value, false);
Writeln(FN34,' </FinInstnId>');
Writeln(FN34,' </CdtrAgt>');
end;
Es optimizable con ayuda de algunas funciones, pero así queda mas legible.
El código está raro porque he tenido que pasarlo por un editor html para no perder las etiquetas xml.