Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert a cursor to a xml
Message
De
19/03/2007 08:34:33
 
 
À
19/03/2007 06:24:05
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01204429
Message ID:
01205439
Vues:
13
Kurt,

>...xml parse error and a dutch error message like 'invalid on the highest level of the document'

As Sergey already posted, it could be a missing 512 flag on XMLTOCURSOR() -- if you are feeding the function a filename as the first parameter. However, you can also get that error if you have the XML in a var and put the varname inside quotes.

The error means that XMLTOCURSOR is reading the first parameter as a string and looking for the XML header line and not finding it in the first line. The first parameter should be either:
1) a filename (inside quotes)
2) a literal string containing the xml (inside quotes)
3) the name of a memvar or other expression like a function call, etc that returns XML (NOT INSIDE QUOTES).
* create XML in cXML var
CURSORTOXML("test", "cXML", 1, 0, 0, "1")
? cxml
CLOSE DATABASES all

* create mytest cursor from the cXML var

* NOTE: This version will give the error:
XMLTOCURSOR("cxml", "mytest")

* NOTE: This version will work correctly
XMLTOCURSOR(cxml, "mytest")
From part of the help file about XMLTOCURSOR's first parameter -- this is for the eExpression option, not the filename option:

eExpression
Specifies the XML text or an expression that evaluates to valid XML data. The eExpression parameter can be a Visual FoxPro memory variable, memo field contents, the return from an HTTP request, the return result from a SOAP method call, XML from the XMLDOM, or an ADO stream.
Note:
XMLCURSOR( ) generates an error if eExpression is not found or if eExpression does not parse to valid XML.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform