Microsoft KB Archive/256538

= Creating an XML Page and Style Sheet to Display FoxPro Data =

Article ID: 256538

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q256538



SUMMARY
FoxToXML.prg is a program file that creates a custom FoxPro class that uses a FoxPro cursor or table to create an eXtensible Markup Language (XML) page and an eXtensible Stylesheet Language (XSL) style sheet to display FoxPro data.

The FoxPro class (FoxToXML) has a method that creates an XML file, a method that creates an XSL file, and a method that creates both files. Each method takes either no parameter and uses the currently open cursor or table to create the XML/XSL files or takes a table name as a parameter to create the files.

The creation of the XML/XSL documents uses native Visual FoxPro 6.0 language and the custom class can be instantiated and used whenever an XML or XSL document is needed. The XML/XSL document names are derived from the cursor or table name.

Without the XSL file, the XML data displays in hierarchical form. Create just an XML file and delete the "?xml-stylesheet ..." line to see how the XML data looks without the style sheet.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

FoxToXML.exe

Release Date: Mar-29-2000

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

The FoxToXML.EXE file contains the following files:

FoxToXML.exe is a self-extracting zipped file that contains a Visual FoxPro 6.0 program file and a readme file called FoxToXML.HTM.

The FoxToXML program file contains code that creates a FoxPro custom class with three methods that create an XML file, an XSL file, or both files. Once the zipped files have been extracted, the XML and XSL files can be created as follows:   Create a new program called Test.prg, and add the following code: CD JUSTPATH(SYS(16)) USE ? && Choose any FoxPro table oXML = NEWOBJECT("FoxToXML","FoxToXML.PRG") oXML.BOTH  Save the program as TEST.PRG in the same directory as FoxToXML.PRG. Run TEST.PRG. This creates both an XML and XSL file with the name of the open table or cursor.

Alternatively, the following code creates an XML file with the name XYZ.XML (the name of the cursor): SELECT * FROM tablename into CURSOR xyz SET PROCEDURE TO FoxToXML.PRG oXML = CREATEOBJECT("FoxToXML") oXML.XML This code creates XML and XSL files in the default directory with the same name as the currently selected table or cursor. Double-click the XML file to display the FoxPro data in the default Internet browser.

