I have a client with a need for XML output from Foxpro. I have played with it a bit in the past- enough to generate something useful, but he needs a specific header in his XML file and I have not figured out how add it:
In the past I have made simple XML files from a Cursor that generate data in this fashion:
<?xml version="1.0"?>
-<Tablename>
-<Field1>datum1</Field1>
-<Field2>datam2</Field2>
-</Tablename>
Foxpro will do that just with the CURSORTOXML() command. But, this time I need to add some sort of a header defination:
<?xml version="1.0"?>
-<Mcr reportingDate="2011-01-01" periodType="MCRYTD" year="2011" type="S">
-<Tablename>
-<Field1>datum1</Field1>
-<Field2>datam2</Field2>
-</Tablename>
-</mcr>
And I am lost how to do this. Any ideas, or useful references to a how to guide on this?
Frank
1. create first xml with CURSORTOXML() into a string variable (see parameter cOutput, set it as the variable name)
2. manipulate the string, eg stuff the new header into it via the STUFF() function, STUFF at the position right before the <tablenam> tag.
3. write the string to an xml file.
Bye, Olaf.