Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Serializable Objects?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00723783
Message ID:
00723794
Views:
13
This message has been marked as the solution to the initial question of the thread.
Hi Steve,

You could take a look at Rick's wwXML library. it has methods to serialize/deserialize VFP objects into XML documents and vice-versa.

The following example was taken from my book (adapted to English):
SET CLASSLIB TO wwXML ADDITIVE

*-- Create a customized "Person" object and initializes its properties
LOCAL loFabio
loFabio = CREATEOBJECT("Person")
loFabio.FName = "Fabio"
loFabio.Age = 28


*-- Now serializes the object into an XML stream with a schema
LOCAL loXML, lcXML
loXML = CREATEOBJECT("wwXML")
loXML.nCreateDataStructure = 1  && Schema
lcXML = loXML.ObjectToXML(loFabio)


*-- Create a new object based on the XML and show the values of the properties
loClone = CREATEOBJECT("Person")
loClone = loXML.XMLToObject(lcXML, loClone)
MESSAGEBOX(loClone.FName)
MESSAGEBOX(loClone.Age)
MESSAGEBOX(loClone.SayHello())


*-- Class Person
DEFINE CLASS Person as Custom
  FName = ""
  Age = 0
  
  FUNCTION SayHello()
    RETURN "Hello"
  ENDFUNC
  
ENDDEFINE
-----
Fabio Vazquez
http://www.fabiovazquez.com
Previous
Reply
Map
View

Click here to load this message in the networking platform