0
votes
59     for (i=0; i < count; i++) //count = number of children
60     {
61        if (localXML.children()[i].Name.toString != firstName ¬
          && localXML.children()[i].Surname.toString != surName ¬
          && localXML.children()[i].Company.toString != companyName)
62        {
63          tempXML.appendChild(localXML.children()[i]);
64        }
65        trace("tempXML: --> "+tempXML);
66        localXML = tempXML; <---- WRONG PLACE!!!
67     }

Hello all. I'm getting an error #1010 at line 61.

I did test each value individually and everyone is traced normally. The errors are:

  • TypeError: Error #1010: at ... frame9:61
  • The script is allways appending localXML.children()[0] and none else.

I can't see any error there. Any idea?

Thanks in advance.

SOLVED:

59     for (i=0; i < count; i++) //count = number of children
60     {
61        if (localXML.children()[i].Name != firstName ¬
      && localXML.children()[i].Surname != surName ¬
      && localXML.children()[i].Company != companyName)
62        {
63          tempXML.appendChild(localXML.children()[i]);
64        }
65     }
66        trace("tempXML: --> "+tempXML);
67        localXML = tempXML;  <---- MOVED HERE!!!

I was updating localXML in with every loop!!! Shame!!!

1

1 Answers

1
votes

Check the XML. Either localXML.children()[i] is null or Name does not exist as a child node on the object.

Also remember that if Name is an attribute in the XML, then you need to access it differently.

If the Name is setup like this:

<node>
    <Name>Stuff</Name>
</node>

Then you access it as you have done so already. But if it is an attribute like so:

<node Name="stuff"></node>

Then you need to access it like this:

localXML.children()[i].@Name

Another possible issue is the children() call. I've never used it before so I do not know specifically how it behaves. If the above issues do not fix it, try rewriting the parser to skip the children() call and just parse it like you normally would with nested loops.

In the end, though Error #1010 means a term is undefined and doesn't exist so you just need to figure out why it doesn't exist.