dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Updating XML2

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    10
    I can't read my posts or responses in that other thread - ???

    I can add new nodes - but not update old ones!! Here's my code :

    newNode = xmlList[index].cloneNode(true);
    nodeElements = newNode.childNodes

    for(z=0;z<=nodeElements.length;z++) {
    switch (nodeElements[z].nodeName) {
    case "var":nodeElements[z].firstChild.nodeValue = var; break;

    ....

    }

    newNode.childNodes = nodeElements;
    //increment index is adding new value
    xmlList[index] = newNode;

    When I'm calling this to add a new value to xmlList which contains *all* my XML this works great, but when I try to *update* an array element for whatever reason it doesn't work. Is this something to do with arrays, or just arrays containing xml objects inside??

    Any suggestions are appreciated ,
    Z.

  2. #2
    Junior Member
    Join Date
    Jun 2002
    Posts
    10
    Before updating a node (inside the array), you need to delete it first:

    xmlList[index].removeNode();

    Sweet

    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center