Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does Cursortoxml() move record pointer to EOF()?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Does Cursortoxml() move record pointer to EOF()?
Miscellaneous
Thread ID:
01639327
Message ID:
01639327
Views:
85
Hi,

I would like to confirm that what I am experiencing is by design and makes sense.

I have an XML file. The XML is loaded into a cursor (using XMLTOCURSOR()).
Then values of some fields are changed and the cursor is saved to the XML (using CURSORTOXML())
Then some value of the same cursor are changed and the cursor is saved to the XML again. On the 2nd save (and on), the values are not saved to the XML.
I placed some test code and determine that after the first CURSORTOXML() the record pointer of the cursor is at EOF(). Which, I guess, causes that on the next CURSORTOXML() the XML is not updated.

I resolved this by GO TOP in the cursor after each CURSORTOXML().

Does it make sense?

UPDATE: From VFP Help:
CURSORTOXML( ) output adheres to the cursor index order, SET FIELDS TO, and current filter settings. However, 
it does not preserve the cursor location. After the calling CURSORTOXML( ), if all records are output, the 
cursor record pointer reports EOF. If not all records are output, it points to the last record output to XML.
So it confirms that the record pointer moves to EOF(). I suppose that my "solution" of moving the pointer to the TOP makes sense.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform