FILEXML CLASS : A REGLA FOR XMAS

FILEXML CLASS : A REGLA FOR XMAS

Postby Silvio » Wed Dec 02, 2009 9:14 am

I made a class from an Idea of James
You can create a file xml and save it from a database dbf

Today I sent to Antonio the class


This is the test


Procedure test()
Local oXml, n
Local cType, cTag

DEFINE XML oXml FILE "TEST.xml" FORMAT

CREATEXML FILEMARK "CUST" ATTRIB "Database" VALUE "CUST" OF oXml // CUST OR CUSTOMERS

USE CUSTOMER

GO TOP
USE CUSTOMER

GO TOP

DO WHILE !Eof()

CREATEXML FILEMARK "Record" ATTRIB "Numero" VALUE Str( Recno() ) OF oXml

FOR n := 1 To FCount()

cType := If( ValType( FieldGet( n ) ) == "D", "date", )

cTAg := If( ValType( FieldGet( n ) ) == "D", dTos( FieldGet( n ) ), OemToAnsi( FieldGet ( n ) ) )

CREATEXML FILEMARK FieldName( n ) TYPE cType TAG cTag AUTOCLOSE OF oXml

NEXT

CLOSEXML FILEMARK OF oXml

SKIP

ENDDO

CLOSEXML FILEMARK OF oXml

ENDXML oXml

? "Converted to XML"

RETURN NIL



and this is the file generated ( a part of the file from record number 1 to record number 3 )


Code: Select all  Expand view
   

<?xml version="1.0"  encoding="ISO-8859-1"?>
     <CUSTOMER xmlns:dt="urn:schemas-microsoft-com:datatypes" Database = "CUSTOMER" >
     <Record Numero = "         1" >
     <FIRST>Homer               </FIRST>
     <LAST>Simpson             </LAST>
     <STREET>32179 Maiden Lane             </STREET>
     <CITY>Springfield                   </CITY>
     <STATE>IL</STATE>
     <ZIP>20503-8202</ZIP>
     <HIREDATE dt:dt= "date">19920918</HIREDATE>
     <MARRIED></MARRIED>
     <AGE></AGE>
     <SALARY></SALARY>
     <NOTES>This is a test for record 1                                           </NOTES>
     </Record>
     <Record Numero = "         2" >
     <FIRST>Ceci                </FIRST>
     <LAST>Gibbard             </LAST>
     <STREET>9540 Raynes Park Road         </STREET>
     <CITY>Miami                         </CITY>
     <STATE>MA</STATE>
     <ZIP>55774-2304</ZIP>
     <HIREDATE dt:dt= "date">19841017</HIREDATE>
     <MARRIED></MARRIED>
     <AGE></AGE>
     <SALARY></SALARY>
     <NOTES>This is a test for record 2                                           </NOTES>
     </Record>
     <Record Numero = "         3" >
     <FIRST>Reg                 </FIRST>
     <LAST>Kaczocha            </LAST>
     <STREET>30522 Park Ten Place          </STREET>
     <CITY>Scottsdale                    </CITY>
     <STATE>WY</STATE>
     <ZIP>09226-1483</ZIP>
     <HIREDATE dt:dt= "date">19890523</HIREDATE>
     <MARRIED></MARRIED>
     <AGE></AGE>
     <SALARY></SALARY>
     <NOTES>This is a test for record 3                                           </NOTES>
     </Record>
   
     </CUSTOMER>
 
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: FILEXML CLASS : A REGLA FOR XMAS

Postby Antonio Linares » Wed Dec 02, 2009 9:36 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41390
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests