Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XmlToCursor() problem
Message
 
À
15/01/2015 16:26:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01613703
Message ID:
01613708
Vues:
78
Couple of things:

Export with a Schema. If you export without you may not get the right type of data back in. I don't htink that's a problem with what you have going on here but it's a good idea regardless. It will bloat the data some unfortunately though.

Use UTF-8 encoding - there's a flag for that I believe. Using Windwos 1252 is generally a bad idea if the XML ever goes onto a non-windows machine.

Finally - consider using XmlAdapter instead of XmlToCursor(). XmlAdapter is better optimized and uses MsXml 4.0 instead of 2.0 of CursorToXml(). There are some helpers in Web Connection and the client tools with the wwXmlAdapter which wrap some of the common operations you're likely to perform.

Now - honestly - none of these would account for the bad character error you're seeing unless you are dealing with binary data in a memo field. That'll fail as soon as CHR(0) is encountered I think. I believe XmlAdapter deals with binary data a little more gracefully.

+++ Rick ---



>I used CursorToXML() to convert a FoxPro cursor to an XML file. That part worked fine, and it generated what looks like a good XML file to me.
>
>CursorToXML('gfse_searchresults','c:\temp\001.xml',1,512,0)
>
>However, when I try to use XmlToCur() on this XML file to read it back into a cursor, it complains about an invalid character.
>
>XMLToCursor("c:\temp\001.xml", "test",512)
>
>Error: XML Parser error: An invalid character was found in text content. Line 143, Position 15. _memberdata =
>
>I know that one of the fields in my original cursor is a memo field which contains FoxPro code with a reference to the _memberdata property of a form, which is XML already, so it appears that this is causing the XmlToCursor() to fail.
>
>
><?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
><VFPData>
>	<gfse_searchresults>
>		<process>false</process>
>		<filepath>h:\work\lm5\classes\menu.vcx</filepath>
>		<filename>menu.vcx</filename>
>		<trimmedmatchline>cpartcountsource A string that will be Eval'd to get the Qty of the current Part.</trimmedmatchline>
>		<baseclass>grid</baseclass>
>		<parentclass>menugrid</parentclass>
>		<class>gridpartmtlitems</class>
>		<name>cpartcountsource</name>
>		<methodname/>
>		<containingclass/>
>		<classloc>menu.vcx</classloc>
>		<matchtype>&lt;&lt;Property Def&gt;&gt;</matchtype>
>		<timestamp>2014-12-17T17:29:32</timestamp>
>		<filetype>VCX</filetype>
>		<type/>
>		<recno>588</recno>
>		<procstart>0</procstart>
>		<matchstart>12</matchstart>
>		<matchlen>82</matchlen>
>		<listext>false</listext>
>		<column>RESERVED3</column>
>		<code>npartcount
>cpartcountsource A string that will be Eval'd to get the Qty of the current Part.
></code>
>		<id>9</id>
>		<matchline>cpartcountsource A string that will be Eval'd to get the Qty of the current Part.
></matchline>
>		<replaced>false</replaced>
>		<trimmedreplaceline/>
>		<replaceline/>
>		<replacerisk>3</replacerisk>
>		<replace_dt/>
>	</gfse_searchresults>
></VFPData>
>
>
>
>
>.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform