How to create Mapped object Structure in JScript
Hi All,
I have below mentioned Object of Variables inside TestValues which are initially uninitialezed
var TestValues = {name: "", ID: "", BaseNo: ""};
. After reading the values from below xml
<?xml version="1.0"?>
<configurations>
<Properties>
<Property name="name1" ID="0" BaseNo="34"/>
<Property name="name2" ID="1" BaseNo="35"/>
<Property name="name3" ID="2" BaseNo="37"/>
</Properties>
</configurations>
, I have to set the values agianst each variable inside TestValues
but the problem is that, there should be only 1 variable for each value. For ex when i read the name from 1st property it is name1 , for 2nd it is name2. how can i have i variable storing more than 1 value.
There is some concept of mapped object structure in Jscript but i dont know how to use. Please help if you know
I only hardcoded that to give an example.
It could be something like:
var name, ID, BaseNo; for(var i=0; i<totalPropertyNodes;i++){ name = GetNameFromXml(); ID = GetIDFromXml(); BaseNo = GetBaseNoFromXml(); } new Property(name, ID, BaseNo)
Then it is no longer hardcoded.
I am not sure how you get the values from the xml, and I still don't quite understand the result you are expecting.