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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.DLL Variant Array Output to XML

Status
Not open for further replies.

paulray

Technical User
Mar 6, 2003
49
0
0
CA
I have a COM dll that returns a variant multidimensional array.
For example ..data type shown in ()
aR(0,0) = COMPANY NAME (string)
aR(0,1) = COMPANY ADDRESS (string)
aR(0,3) = YTD REVENUE (Double)
aR(0,4) = MTD REVENUE (Double)
aR(0,5) = ACTIVE (Boolean)
then
aR(1,0) = same for the next client and so on.
aR(1,1) = ...

I need to look at converting this output to XML. Where do I start? I have read many threads but seem to be missing something.
Thanks
Paul

 
Have a look at the XMLD0M object and things like the .appendchild properties and .text properties of the XML Document variable type and XML element variable types respectively. Then using a simple loop you should be able to build up your xml document no problem.

e.g.

Dim Doc as new DOMDocument
Dim vnode as IXMLElement

For i = 0 to ubound(aR, 1)
Set vnode = Doc.appendchild("CompanyName")
vnode.text = ar(0,i)
i= i +1
Next

This will build all the company names into an XML document for you (or at least something along those lines will cause I haven't tested it). You could hard code the rest of the field names in a similar fashion or with a bit of a change (like putting the field names in the first row of the array) you could also code around that.




Mark

The key to immortality is to make a big impression in this life!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top