Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XMLADAPTER Class.ToCursor method
Message
 
À
23/03/2006 20:07:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01106122
Message ID:
01107315
Vues:
21
Hi David, thanks for your reply.

It does not contain schema details just raw data. , with it would appear 3 record types

I would have expected VFP to open it ok , in that Dot Net with File..Open seems to have no problem reading it



>Gerard,
>
>>I was lao getting an error when I tried to access the file
>> index or expression does not match member of the collection
>>
>>My Code Is:
>>adapter = CREATEOBJECT("XMLADAPTER")
>>x=Adapter.LoadXML("RAAP.XML",.T.)
>>Adapter.Tables(1).ToCursor()
>
>The error you are getting indicates that the Tables collection does not have any entries in it, which would be the case if the XML you are reading does not contain a schema section and also does not reference an external XSD schema file. Sometimes, you get the same problem if you have schema info but it's too complex for XMLAdapter to understand, but usually you would get a "Schema is too complex" error in that case, so I'm guessing that you don't have schema info at all.
>
>XMLAdapter MUST have schema info before it can create the Tables and Fields collections, which provide the structure for creating cursors. XMLToCursor() can do it without a schema (just one table, however), but XMLAdapter does not. But if configured correctly with schema info, XMLAdapter can handle multiple tables.
>
>You can find out the status of the tables collection by checking the adapter.tables.count after loading the XML and you'll probably see either a value of 0 or get an error that the tables collection does not exist.
>
>So, do you have any schema info internal to the XML file, or an external XSD file? If you have an external file and there is no reference to it in the XML file, you can set the XMLSchemaLocation property to point to the external XSD before calling the LoadXML method.
>
>Sorry, but I'll be offline from now until sometime tomorrow, so I can't provide further help tonight, but I'll check on your progress when I get back online.
>
>PS -- Even without a schema, there is a way to set up XMLAdapter to understand your XML, but it's not for the faint of heart. You can check some of my previous posts about XMLAdapter for that info (and also posts from Aleksey).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform