Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Xmladapter.tocursor strange behaviour
Message
De
08/07/2004 09:14:47
 
 
À
08/07/2004 07:55:29
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Divers
Thread ID:
00921909
Message ID:
00921934
Vues:
16
Hi,
This problem occurs because your cursor name and field name are the same.
Create Cursor mycursor (myfield c(10), mycursor c(10))
I'm sure that's a bug, because XMLTOCURSOR(m.xml) returns one record cursor without a problem. In your case you can use code to change the cursor name in XML.


oXML=NewObject("XMLAdapter")
lcXMLName = STRCONV(STRCONV("newcursor",1),5)
oXML.AddTableSchema("mycursor",.t.,lcXMLName)


I think you are right, it's a bug in XMLAdapter class...

Denis


>I found a behaviour in XMLAdapter.toCursor that seems very much like a bug.
>
>If I have a cursor in which one of the fields has the same name as the cursor itself (including case), when I serialize this cursor (oxmladapter.toxml) and then get the cursor back from the XML, the records are duplicated. Each record has a blank record associated.
>
>Try this code:
>
>
>Create Cursor mycursor (myfield c(10), mycursor c(10))
>Append Blank
>Replace mycursor.myfield with "OLEO"
>
>oXML=NewObject("XMLAdapter")
>oxml.PreserveWhiteSpace= .T.
>oXML.AddTableSchema("mycursor")
>oXML.ToXML('m.cXML')
>
>Select mycursor
>Use
>
>oXML2=NewObject('XMLAdapter')
>oXML2.LoadXML(cXML)
>oxmltable2=oxml2.tables(1)
>oxmltable2.ToCursor
>
>Select mycursor
>Browse
>
>
>You should notice that originally I had one record, and in the end, I got 2 records (one is blank).
>
>If I change the name of the cirsor or the name of the field, then everything goes ok.
>
>Anyone knows anything about this ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform