dbf to Xml
Posted: Fri Jan 23, 2009 5:01 pm
is there a function to create a xml from a dbf ?
www.FiveTechSoft.com
https://fivetechsoft.com/forums/
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Sources</title>
<link>http://www.fivetechsoft.com/news</link>
<description>Dynamic news reader</description>
<item>
<title>News</title>
<link>News</link>
<description>News sources</description>
<pubDate>23 Jan 2009 10:04 am</pubDate>
</item>
<item>
<title>Tech</title>
<link>Tech</link>
<description>Tech sources</description>
<pubDate>23 Jan 2009 10:04 am</pubDate>
</item>
</channel>
</rss>
Code: Select all
#define adOpenForwardOnly 0
#define adOpenKeyset 1
#define adOpenDynamic 2
#define adOpenStatic 3
#define adLockReadOnly 1
#define adLockPessimistic 2
#define adLockOptimistic 3
#define adLockBatchOptimistic 4
#define adPersistXML 1
FUNCTION MAIN()
LOCAL oRs := CREATEOBJECT( "ADODB.Recordset" )
FERASE( "TEST.XML" )
oRs:Open( "SELECT * FROM Test", "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\xharbour; Extended Properties=DBASE III", adOpenForwardOnly, adLockReadOnly )
oRs:Save( "TEST.XML", adPersistXML )
oRs:Close()
RETURN NIL
Code: Select all
FUNCTION MAIN()
LOCAL oStream, oRs
oStream = CREATEOBJECT( "ADODB.Stream" )
oStream:Open()
oStream:WriteText( MEMOREAD( "TEST.XML" ) )
oStream:Position = 0
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( oStream )
oStream:Close()
WHILE !oRs:EOF
? oRs:Fields( "Last" ):Value, oRs:Fields( "First" ):Value
oRs:MoveNext()
ENDDO
oRs:Close()
INKEY( 0 )
RETURN NIL
Code: Select all
<?xml version="1.0" standalone="yes" ?>
- <DATAPACKET Version="2.0">
- <METADATA>
- <FIELDS>
<FIELD attrname="ICLSSESMATID" fieldtype="i4" required="true" />
<FIELD attrname="IMATID" fieldtype="i4" required="true" />
<FIELD attrname="SMATLDESC" fieldtype="string" WIDTH="100" />
<FIELD attrname="SMATSDESC" fieldtype="string" WIDTH="50" />
<FIELD attrname="SMATCODUSER" fieldtype="string" WIDTH="3" />
<FIELD attrname="SMATCODMIN" fieldtype="string" WIDTH="4" />
<FIELD attrname="ICMPSCAID" fieldtype="i4" required="true" />
<FIELD attrname="ISCAID" fieldtype="i4" />
<FIELD attrname="ICMPSCATASS" fieldtype="i4" required="true" />
<FIELD attrname="ICMPSCAINMEDIA" fieldtype="i4" required="true" />
<FIELD attrname="SCMPLDESC" fieldtype="string" WIDTH="100" />
<FIELD attrname="SCMPSDESC" fieldtype="string" WIDTH="50" />
<FIELD attrname="SSCADESC" fieldtype="string" required="true" WIDTH="100" />
<FIELD attrname="ISITID" fieldtype="i4" required="true" />
<FIELD attrname="ICLSSESID" fieldtype="i4" required="true" />
<FIELD attrname="IANAID" fieldtype="i4" />
<FIELD attrname="IANSID" fieldtype="i4" required="true" />
<FIELD attrname="ICLSID" fieldtype="i4" required="true" />
<FIELD attrname="IMATRMAID" fieldtype="i4" required="true" />
<FIELD attrname="IMATINMEDIA" fieldtype="i4" />
<FIELD attrname="ICMPSCAORDINE" fieldtype="i4" required="true" />
<FIELD attrname="IMATRMAPSTORDINE" fieldtype="i4" />
</FIELDS>
<PARAMS LCID="0" />
</METADATA>
- <ROWDATA>
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026702" ICLSSESID="1000260" IANAID="1013669" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026703" ICLSSESID="1000260" IANAID="1014974" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026704" ICLSSESID="1000260" IANAID="1014996" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026705" ICLSSESID="1000260" IANAID="1015284" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026707" ICLSSESID="1000260" IANAID="1016926" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026714" ICLSSESID="1000260" IANAID="1022398" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026715" ICLSSESID="1000260" IANAID="1023089" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026946" ICLSSESID="1000260" IANAID="1019047" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027245" ICLSSESID="1000260" IANAID="1024723" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001870" IMATID="1000016" SMATLDESC="DIRITTO" SMATSDESC="DIRITTO" SMATCODUSER="DIR" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027247" ICLSSESID="1000260" IANAID="1024725" IANSID="38" ICLSID="1001036" IMATRMAID="1000016" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="7" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026702" ICLSSESID="1000260" IANAID="1013669" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026703" ICLSSESID="1000260" IANAID="1014974" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026704" ICLSSESID="1000260" IANAID="1014996" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026705" ICLSSESID="1000260" IANAID="1015284" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026707" ICLSSESID="1000260" IANAID="1016926" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026714" ICLSSESID="1000260" IANAID="1022398" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026715" ICLSSESID="1000260" IANAID="1023089" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026946" ICLSSESID="1000260" IANAID="1019047" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027245" ICLSSESID="1000260" IANAID="1024723" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001871" IMATID="1000035" SMATLDESC="ECONOMIA POLITICA" SMATSDESC="ECONOMIA POLITICA" SMATCODUSER="ECO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1027247" ICLSSESID="1000260" IANAID="1024725" IANSID="38" ICLSID="1001036" IMATRMAID="1000035" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="8" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026695" ICLSSESID="1000260" IANAID="1013018" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026696" ICLSSESID="1000260" IANAID="1013067" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
<ROW ICLSSESMATID="1001872" IMATID="1000003" SMATLDESC="STORIA" SMATSDESC="STORIA" SMATCODUSER="STO" SMATCODMIN="" ICMPSCAID="2" ISCAID="1" ICMPSCATASS="0" ICMPSCAINMEDIA="1" SCMPLDESC="Orale" SCMPSDESC="O" SSCADESC="Decimale" ISITID="1026700" ICLSSESID="1000260" IANAID="1011698" IANSID="38" ICLSID="1001036" IMATRMAID="1000003" IMATINMEDIA="1" ICMPSCAORDINE="2" IMATRMAPSTORDINE="3" />
</ROWDATA>
</DATAPACKET>
Code: Select all
FUNCTION MAIN()
LOCAL oStream, oRs
LOCAL i
oStream = CREATEOBJECT( "ADODB.Stream" )
oStream:Open()
oStream:WriteText( MEMOREAD( "TEST.XML" ) )
oStream:Position = 0
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( oStream )
oStream:Close()
WHILE !oRs:EOF
FOR i = 0 TO oRs:Fields:Count - 1
? oRs:Fields( i ):Value
NEXT
?
oRs:MoveNext()
ENDDO
oRs:Close()
INKEY( 0 )
RETURN NIL