views:

21

answers:

1

I have the following function, designed to walk through XML and create a linear structure of all nodes:

function get_children(n)
  if n.hasChildNodes() then
    for each child in n.childNodes
      set local_array = array_merge(get_children(child), local_array)
    next
  else
    set local_array = Array(n)
  end if
  get_children = local_array
end function

I've tried a ton of variations, but I keep getting errors on the line

set local_array = Array(n)

It it's current form, I see:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/_inc/nav/left-nav.inc, line 37

Am I mis-using the Array() construct? Aren't I able to create an array with a single value?

+2  A: 

Change

set local_array = Array(n)  

to

local_array = Array(0)
set local_array(0) = n 
Yots