Hi, I have a problem with retrieving attribute values via E4x in javascript.
Suppose a list of XML nodes like the following as the XMLObject:
<node att1="value1" att2="value2" att3="value3" att4="value4">
<nodeChild><!CDATA[/* ... */]></nodeChild>
/* more node childs */
</node>
I properly accessed the nodes (in a loop) and its attribute nodes using the attributes()
method:
var attributes = node[n].attributes() ;
for(var n = 0 ; n < attributes.length() ; n++) {
var name = attributes[n].name() ;
var value = attributes[n].toString() ;
//.. handle the values
}
Now, for one, names and values are not adequately returned value(n) returns the value of name(n+1), i.e. the value of att1
will be value2
; if I set var value = attributes[ (n+1) ].toString()
the values are returned correctly but the first value will return undefined
.
Possible I'm just dense on this one. So, does anyone have any pointers to what I am missing?
TIA,
FK