Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Deserialization in VB/VBA

Status
Not open for further replies.

oharab

Programmer
May 21, 2002
2,152
GB
I have a set of VBA classes in an MS Access database. I have an xml string with data I want to create new classes with.

Other than setting each property individually, is there an easy way to deserialize the XML into my object?

I've seen the code using the TypeLib library
Code:
Public Sub ISerializable_Deserialize(xml As IXMLDOMNode) 
 
  Dim tTLI As TLIApplication 
  Dim tInvoke As InvokeKinds 
  Dim tName As String 
  Dim tMem As MemberInfo 
 
  tInvoke = VbLet 
 
  For Each tMem In TLI.ClassInfoFromObject(Me).Members 
 
     tName = LCase(tMem.Name) 
 
     CallByName Me, tMem.Name, VbLet, xml.Attributes.getNamedItem(tName).Text 
 
  Next tMem 
End Sub
but this doesn't seem to work with the standard class modules. I get a 429 error:

ActiveX Component Cannot Be Created
Can anyone else help me out? I'd rather not have to set each propery by hand if I can help it, some of these classes are huge!


----------------------------------------------
Ben O'Hara
David W. Fenton said:
We could be confused in exactly the same way, but confusion might be like Nulls, and not comparable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top