0 Replies Latest reply on Dec 18, 2006 5:28 PM by s6868

    Add xml element error

    s6868 Level 1
      I am trying to add a new element to an xml file, I has 5 existing, so I am trying to add the sixth. but got an error message, anyone could help me on this?


      The index of a child element is out of range.
      There are only "5" children under this node.
      Therefore index "6" is out of the allowed range [1-5].

      The error occurred in C:\CFusionMX7\wwwroot\myfolder\addNew.cfm: line 18

      16 : newNodePos = arrayLen(variables.xml.machii.listeners.listener) + 1;
      17 : // add new node then set it's attributes
      18 : variables.xml.machii.listeners.listener[variables.newNodePos]= XMLElemNew(variables.xml,"listener");
      19 : structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);

      here the code:
      // get array position of next XML child to add
      newNodePos = arrayLen(variables.xml.machii.listeners.listener) + 1;
      // add new node then set it's attributes
      variables.xml.machii.listeners.listener[variables.newNodePos]= XMLElemNew(variables.xml,"listener");
      structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);