0 Replies Latest reply on Jan 12, 2008 5:40 AM by gshockoman

    XMLList issues

    gshockoman
      Hello.

      I'm new to flex and actionscript.
      I'm trying to loop over xml data and if the node i'm running over has children, then recursively call the same function on the node's children.

      As far as I saw, the better use for my is XMLList over XML.
      If I'm wrong, please enlight me. :-)
      This is my function:

      [code]
      private function handleValueObjects(xmlContent:XMLList):void{
      for each (var xmlNode:XMLList in xmlContent.children()){
      var VO:ValueObject = new ValueObject(xmlNode);
      if (xmlNode.@type == 'group') {
      handleValueObjects(xmlNode.children());
      }
      addTemplateItem(VO);
      }
      }
      [/code]

      When it runs, I'm getting the following error:
      TypeError: Error #1034: Type Coercion failed: cannot convert XML@150ce09 element <dapper xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> to XMLList.

      The line it says that caused this is the foreach line.

      What am I doing wrong?

      Thank you.