dynamically change xml attributes


hi,

 

i have teh following xml

xml = <books>

     <book name="book 1" author="author 1" price="50 usd"/>

</books>

 

i have following array

 

var arr = ["name", "book new", "author", "author new", "price", "10 usd"];

 

var dynamically generated no know order of attributes. thing know array has elemenst in [attname, attvalue, attname, attvalue, attname, attvalue...] way. size of array not known in advance.

 

now trying ot -

 

for(var i=0;i<arr.length;i+2){

     xml.books.book.attribute(arr[i]) = arr(i+1);

}

 

and throwing following error -

target of assignmnet must reference value.

 

how around this? appreciated. thanks,

have tried this:

 xml.books.book.attribute(arr[i]) = arr[i+1]; 

what error number getting?



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???