Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert text file into XML
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Convert text file into XML
Miscellaneous
Thread ID:
01659084
Message ID:
01659084
Views:
60
Hi,

Say I have a text file saved on a drive that is almost like an XML. For example, the file will look like this:
<Record>
   <FirstName>John</FirstName>
   <LastName>Smith</LastName>
</Record>
<Record>
   <FirstName>Paul</FirstName>
   <LastName>Kelly</LastName>
</Record>
So, as you can see, the file does not have the typical top line:
<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
And it does not have the Root Element, such as, for example:
<VFPData>
</VFPData>
And I want to load this text file into a cursor using the code:
XMLTOCURSOR( "MyTextFile.txt", Cur_Name, 512+8192)
I know that I can retrieve the string using STRTOFILE() and then add the top line and the Root Element. But that would be slow since the entire text file would have to be first loaded into a string. Is it possible to load the above text file into a cursor and add the top line and the Root Element on-the-fly?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform