Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Write text file without EOF marker?
Message
 
 
À
10/10/2003 11:21:22
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00837438
Message ID:
00837454
Vues:
30
This message has been marked as a message which has helped to the initial question of the thread.
Bob,

You shouldn't have this problem if you switch to textmerge.
lcXmlFile = 'myfile.xml'
SET TEXTMERGE TO (lcXmlFile )
SET TEXTMERGE ON NOSHOW
\\ [<ROOT>]
\\ [<TAG>] + <<xmlencode(TABLE.FIELD)>> + [</TAG>]
\\ [<TAG2>] + <<xmlencode(TABLE.FIELD2)>> + [</TAG2>]
\\ [</ROOT>]
SET TEXTMERGE TO
Or you can build whole XML as a string and than save it to a file using STRTOFILE().
To remove EOF character you can use code from Re: Can't get rid of strange character in M field. Message #766323.

>Hi All,
>
>I am creating an XML file with FoxPro for Win 2.6a and we are having a small problem. I am using code such as:
>
>
>SET ALTERNATE TO 'myfile.xml'
>SET CONSOLE OFF
>SET ALTERNATE ON
>
>?? [<ROOT>]
>?? [<TAG>]+xmlencode(TABLE.FIELD)+[</TAG>]
>?? [<TAG2>]+xmlencode(TABLE.FIELD2)+[</TAG2>]
>?? [</ROOT>]
>
>SET ALTERNATE OFF
>SET ALTERNATE TO
>SET CONSOLE OFF
>
>
>The xmlencode() function just trims the data and replaces &,<,> etc chars with appropriate encoded values.
>
>We get the XML file, but there is an EOF charater or something put at the end of the file. It looks like a little square box in notepad. I get an error if I try to open the XML in IE or import it with the parser. But, if I go into notepad and delete that little square thing it works great.
>
>How can I avoid that little EOF guy. Or, how can I remove it without having to bring all my XML into memory and trim that off (this was our original try but not that we are using real world data it is larger than 2.6 string can handel).
>
>Thanks,
>BOb
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform