Avatar of fmoore0001
fmoore0001
 asked on

XML and Foxpro

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
FoxPro

Avatar of undefined
Last Comment
Cyril Joudieh

8/22/2022 - Mon
SOLUTION
Cyril Joudieh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Olaf Doschke

Either that or

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.
ASKER CERTIFIED SOLUTION
Pavel Celba

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Cyril Joudieh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23