Hola amigos
Teneis alguna idea de como se puede exportar una tabla mysql a xml ?
un saludo y gracias desde ya
Exportar a Xml
Yo lo hago asi...
Amigo yo llo hago de la siguiente manera:
Espero te sirva
Code: Select all
nmanejador:=FCREATE("C:\lymam32\lamxml\"+nArchi+".xml", FC_NORMAL)
bufer:='<?xml version="1.0" encoding="ISO-8859-1"?><mas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/1002.xsd">'+CRLF
bufer+='<Cab>'+CRLF
bufer+='<Ano>2006</Ano>'+CRLF
bufer+='<CodCpt>1</CodCpt>'+CRLF
bufer+='<Formato>1002</Formato>'+CRLF
bufer+='<Version>6</Version>'+CRLF
bufer+='<NumEnvio>1</NumEnvio>'+CRLF
bufer+='<FecEnvio>2006-06-03T10:20:55</FecEnvio>'+CRLF
bufer+='<FecInicial>2005-01-01</FecInicial>'+CRLF
bufer+='<FecFinal>2005-01-01</FecFinal>'+CRLF
bufer+='<ValorTotal>50000</ValorTotal>'+CRLF
bufer+='<CantReg>2</CantReg>'+CRLF
bufer+='</Cab>'+CRLF
SELE tRes1
SET FILT TO ARformat=vForma
DBGOTOP()
DO WHILE .NOT. EOF()
ide:=tRes1->ARnit
con:=tRes1->ARconcep
deb:=tRes1->ARdebito
cre:=tRes1->ARcredit
val:=cre-deb
SELE tTerc
IF dbseek(alltrim(str(val(ide))))
no1:=tTerc->ATprinom
no2:=tTerc->ATsegnom
ap1:=tTerc->ATpriape
ap2:=tTerc->ATsegape
ran:=tTerc->ATrazons
dig:=tTerc->ATdigito
mun:=tTerc->ATmunici
tip:=tTerc->ATtipdoc
tel:=tTerc->ATtelefo
dic:=tTerc->ATdirecc
ELSE
no1:=no2:=ap1:=ap2:=ran:=dig:=mun:=tel:=dic:=space(5)
tip:=0
ENDIF
bufer+='<rets '
bufer+='cpt="'+con+'" '
IF !Empty(alltrim(str(tip)))
bufer+='tdoc="'+alltrim(str(tip))+'" '
ENDIF
IF !Empty(alltrim(str(val(ide))))
bufer+='nid="'+alltrim(str(val(ide)))+'" '
ENDIF
IF !Empty(dig)
bufer+='dv="'+dig+'" '
ENDIF
IF !Empty(alltrim(ap1))
bufer+='apl1="'+alltrim(ap1)+'" '
ENDIF
IF !Empty(alltrim(ap2))
bufer+='apl2="'+alltrim(ap2)+'" '
ENDIF
IF !Empty(alltrim(no1))
bufer+='nom1="'+alltrim(no1)+'" '
ENDIF
IF !Empty(alltrim(no2))
bufer+='nom2="'+alltrim(no2)+'" '
ENDIF
IF !Empty(alltrim(ran))
bufer+='raz="'+alltrim(ran)+'" '
ENDIF
IF !Empty(alltrim(dic))
bufer+='dir="'+alltrim(dic)+'" '
ENDIF
IF !Empty(alltrim(subs(mun,1,2)))
bufer+='dpto="'+alltrim(subs(mun,1,2))+'" '
ENDIF
IF !Empty(alltrim(subs(mun,3,4)))
bufer+='mun="'+alltrim(subs(mun,3,4))+'" '
ENDIF
bufer+='vabo="'+alltrim(transform(val+300000,"999999999999"))+'" '
bufer+='vret="'+alltrim(transform(val,"999999999999"))+'"/>'+CRLF
SELE tRes1
tRes1->(dbskip())
ENDDO
//bufer+='<rets cpt="2302" tdoc="31" nid="79760202" dv="9" apl1="AREVALO" apl2="SUAREZ" nom1="LEANDRO" nom2="ALFONSO" dir="CALLE 74 15 80" dpto="91" mun="263" vabo="350000" vret="25000"/>'+CRLF
//bufer+='<rets cpt="2304" tdoc="31" nid="52236361" dv="7" apl1="FERNANDEZ" apl2="RIVAS" nom1="JUDITH" nom2="MARCELA" dir="CALLE 74 15 80" dpto="91" mun="263" vabo="350000" vret="25000"/>'+CRLF
bufer+='</mas>'
FWRITE(nManejador, alltrim(bufer))
FCLOSE(nManejador)
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]