Let's say that I have an xml file with:
<PRODUCTS>
<PRODUCT>
<SKU>AAA111</SKU>
<NAME>Name One</NAME>
<COLORS>
<COLOR><ID>BK</ID><PRICE>10</PRICE></COLOR>
<COLOR><ID>WH</ID><PRICE>20</PRICE></COLOR>
</COLORS>
</PRODUCT>
<PRODUCT>
<SKU>BBB222</SKU>
<NAME>Name Two</NAME>
<COLORS>
<COLOR><ID>BK</ID><PRICE>20</PRICE></COLOR>
<COLOR><ID>WH</ID><PRICE>30</PRICE></COLOR>
</COLORS>
</PRODUCT>
<PRODUCTS>
When the session starts, I want to create a Session Variable/Object
that can be used in ASPs later like this:
(Example Use in VBScript)
Dim colProducts
colProducts = Session("PRODUCTS")
For Each oProduct In colProducts
Response.Write(oMyProduct("SKU")
For Each oColor In oProduct("COLORS") ' Access a SUB collection
directly.
Response.Write(oColor("ID"))
Next
Next
oMyProduct = colProducts("AAA111")
Response.Write(oMyProduct("NAME"))
It has been a very long time since I coded, and so my code is probably
a bit rusty. Also, I have never really worked with collections.
My questions are:
1.) In my session_onstart code, how do I create a collection and store
it into the session variable? What language should I use? Code
Examples?
2.) In my ASPs, how do I propperly access those collections and
sub-collections? Languages? Code Examples?
Thanks in advance.