dim i,ct as integer
dim n as XmlNode
dim s as string
ct = categoryNode.ChildCount - 1
subcategories = new Dictionary
for i = 0 to ct
  n = categoryNode.Child(i)
  if n.ChildCount > 0 then
    dim nc as XmlNode
    s = n.Name
    s = n.Value
    s = n.ToString
    nc = n.FirstChild
    s = nc.value
    s = nc.ToString
    Select case n.Name
    case "accountId"
      accountId = val(n.FirstChild.value)
    case "categoryId"
      categoryId = val(n.FirstChild.value)
    case "id"
      id = val(n.FirstChild.value)
    case "description"
      description = n.FirstChild.value
    case "parentId"
      parentId = val(n.FirstChild.value)
    case "subcategoryCount"
      subcategoryCount = val(n.FirstChild.value)
    case "subcategories"
      dim subcategoryIndex, count as integer
      dim subcategoryNode as XmlNode
      dim c as Category
      count = n.ChildCount - 1
      for subcategoryIndex = 0 to count
        subcategoryNode = n.Child(subcategoryIndex)
        if subcategoryNode.Name = "Category" then
          c = new Category(subcategoryNode)
          subcategories.Value(c.id) = c
        end if
      next
    end select
  end if
next