How do I write XML to a SW assembly

I would like to write some information to a SW assembly. I know it can be done using XML format and ModelDoc2::IGet3rdPartyStorage should be used.

Does anybody have some code to

    

     serialize the text string

     deserialize the XML string

     write the XML to the SW file

     read the XML from the the SW file

All should be done in in SW API. The serializing could ofcourse be done using an external program, but I prefere to have it in the API program.

I have downloaded STRM.tlb and included it in my project to get the IStream type.

I started with these lines, but don't get the stream.

Sub main()
Dim flag As Boolean
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim str As IStream

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

Set str = swModel.IGet3rdPartyStorage("TestXML", True)
swModel.IRelease3rdPartyStorage ("TestXML")

End Sub

Any help would be appreciated.
SolidworksApi macros