5 Replies Latest reply on Jan 5, 2007 8:58 AM by Peter Lorent

    I have one little question about associative arrays...

    Miran Loncaric Level 1
      HI!

      I'm creating one simple custom class, which will get data from xml...

      The idea is to create fully dinamical class which will get data from xml file and named every part of array with the attributes, and fill it with its content...
      ...hope that make sense...

      For example:

      part of xml file:
      title="sample 1"

      part of class code:
      for (var j in nodes[x].attributes)
      {
      content.push({j:nodes[x].attributes[j]});
      }


      ...variable "j" gets the name from the current attribute, inside the current item(nodes[x].attributes) in the xml file...so I'm using it as a identifier of the current part of array...
      I get the value from the current attributes value(nodes[x].attributes[j])...

      At the end I'm adding them to the content array(content.push({j:nodes[x].attributes[j]}))...

      I really hope you understand, what am I trying to say...

      ...But when I trace the content(I've tried adding the identifiers to its end('...].title' or something similar))...
      I allways get [object Object] or unidentified...

      If you have any idea how to do that, please tel me...
      ...or if it's even possible...

      Thanks in advance...

      EDIT:

      Please, ignore 'id' and 'value' variables... I forgot to delete them...
      ([x] is actually i... but I've changed it, because of that italic style of text)...