“Asp Associative Array Class” provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file :
[sourcecode language=”vb”] <!–#include file="AssociativeArrayClass.asp" –><%
Dim Person, God
Set Person = New AssociativeArray
Set God = New AssociativeArray
Person("name") = "Max"
Person("surname") = "Vergelli"
God("name") = "Jesus"
God("surname") = "Christ"
Dim World
Set World = New AssociativeArray
World(1) = Person
World(2) = God
response.Write World.ToXML()
%>
[/sourcecode]
And You will get out the following XML:
[sourcecode language=”xml”] <?xml version="1.0" encoding="utf-8"?><array>
<key>
<name><![CDATA[1]]></name>
<value>
<key>
<name><![CDATA[name]]></name>
<value><![CDATA[Max]]></value>
</key>
<key>
<name><![CDATA[surname]]></name>
<value><![CDATA[Vergelli]]></value>
</key>
</value>
</key>
<key>
<name><![CDATA[2]]></name>
<value>
<key>
<name><![CDATA[name]]></name>
<value><![CDATA[Jesus]]></value>
</key>
<key>
<name><![CDATA[surname]]></name>
<value><![CDATA[Christ]]></value>
</key>
</value>
</key>
</array>
[/sourcecode]
Leave a Reply