Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Xml and xsd files used with xmltocursor and cursortoxml
Message
From
10/11/2007 07:33:16
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01268148
Message ID:
01268192
Views:
16
Thanks so much Boris, I'm doing the same thing... :o)


>>I have somewhat complex xsd and xml files. The xsd file lists the structure for 4 tables. When I load the xsd file into Visual Studio 2005, it displays the appropriate number of tables based on the xsd file and each of the fieldnames and type is correct for each table. However, when I attempt to readin the xml file (which has one record for each table in it as it is sample data only), only the first table's record in the xml comes in correctly. The table layout matches the first table definition (for fieldnames and types) based correctly on what is in the xsd, so what happens is that each additional record has a null value in each field because the xml tags don't match the fieldnames. How to use xmltocursor when an xml file contains records for different structured cursors? I started using xmladapter but I haven't gotten far because loadxml bombs on line 1 of the xml. It's been awhile since I worked with xml and vfp and never did an xsd have multiple definitions in it.
>
>I copied both files in some folder and played a little with XMLAdapter. That creates cursors for each table:
>
>CLOSE DATA ALL
>oXML = NEWOBJECT([XMLAdapter])
>oXML.XMLSchemaLocation = ([d:\XMLTest\test2.xsd])
>oXML.LoadXML([d:\XMLTest\test2.xml],.t.,.t.)  && Second parameter is crucial. It shows that the first parameter is a disk file, not a memory variable.
>FOR lnFor = 1 TO oXML.Tables.Count
>    oXML.Tables.Item(lnFor).ToCursor()
>    BROWSE NOWAIT
>NEXT
>
>
>
>Now I search WHY I can't get the data in the cursors :-)
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform