Ver Mensaje Individual
  #1  
Antiguo 30-12-2003
cisterpe cisterpe is offline
Miembro
 
Registrado: sep 2003
Posts: 75
Reputación: 23
cisterpe Va por buen camino
Pasar de tabla a XML (ASCII)

Bien tengo que construir un XML a partir de una TABLA

He visto esto en el foro...

Cita:
var
Lineas: TStringList;
Linea: String;

begin
Lineas := TStringList.Create;

while not Table.Eof do
begin
Linea := '';
for I := 0 to Table.Fields.Count - 1 do
if Linea = ''
then Linea := Table.Fields[i].AsString
else Linea := Linea + ',' + Table.Fields[i].AsString;

Lineas.Add(Linea);
Table.Next;
end;

Lineas.SaveToFile('tuarchivo.txt');
Lineas.Free;
end;
La finalidad es..

//Tabla
C1----->C2----->C3----->C4
A----->null----> null---->null
null---->B------->C------>null
null---->null---->null----->D
//
y el xml debe ser

<xml>
<1>
---><C1>
----->A
---></C1>
</1>
<2>
---><3>
-----><C4>
------->D
-----></C4>
---></3>
---><C2>
----->B
---></C2>
----><C3>
----->C
---></C3>
</2>
</xml>
No se como adaptarlo

Última edición por cisterpe fecha: 30-12-2003 a las 10:18:10.
Responder Con Cita