Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XMLTOCURSOR() function with no schema
Message
From
02/11/2005 16:00:17
 
 
To
02/11/2005 14:02:58
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
01064451
Message ID:
01064732
Views:
31
Mike,

>PMFJI. Does the cursor need to be created such that the field order is the same as in the XML file layout?

Assuming that you use VFP8 or higher and can, therefore, use the 8192 flag (append to existing cursor), you'll find that the mapping is not positional and is done strictly by XML tag name to VFP field name, as the following code demonstrates:
CREATE CURSOR mytest (test1 c(5), test2 c(5), test3 c(5))
INSERT INTO mytest VALUES ("test1", "test2", "test3")
BROWSE
CURSORTOXML("mytest", "mytest.xml",1,512)
MODI FILE mytest.xml NOMODIFY
USE IN mytest
CREATE CURSOR mytest (test2 c(5), test3 c(5), test4 c(5))
XMLTOCURSOR("mytest.xml","mytest", 512+8192)
BROWSE
USE IN mytest
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform