Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor to XML not picking up lines
Message
From
12/06/2017 18:05:05
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008 R2
Network:
Windows Server 2008 R2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01650938
Message ID:
01651947
Views:
82
Likes (1)
>...
>>>Thanks, reckon I'm on the right track now but still stuck. I have the code read into a variable and I have the following so that it removes the first x characters.
>>>
lcContent = SUBSTR(lcContent,AT("<",lcContent,1), LEN(lcContent) - (AT("<",lcContent,1) - 1))
>>>I show this to screen and it looks okay. But if I try to use it I get the adapter.tables.Count = 0. If I StrToFile and then read it back in I get the same Unicode BOM error.
>>>~M
>>
>>The document encoding is different from the one that is declared (UTF-16) and the parser is complaining at thar. If no one else steps in, I'll come back to you later, unless you find a solution for yourself (I'll have to go offline for a few hours).
>The file should have been sent to me in utf-8 and I thought that the utf-8/utf-16 string was a flag to show how it was to be interpreted rather than a storage format that modified the file itself.
>As it said utf-16 what I'm doing is using FileToStr and reading in the file. Then doing a StrTran to replace the utf-16 with utf-8. I'm also doing a StrConv(StrConv( , 11 ) , 2 ) to bring the file back to single byte format. Finally I'm doing a SubStr() of the file to exclude any characters before the first
<
. I then save the file as file1.txt and use FileToStr of this file but no joy. I know that I'm hovering around the solution and it does work if the data is in the prg file rather than coming from a variable so it's close but just can't get the last part over the line.
>~M

If you open the file in notepad, and save it again as Unicode, without any other change, you will be able to successfully .Load() the file.

Otherwise, you can .LoadXML(SUBSTR(FILETOSTR(GETFILE("xml")),4)).
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform