XML load problem

I have not used real basic/xojo in over 6 years, I took a break from programming. To make a long story short, I am having a problem loading xml and parsing the catagories and note. I was able to create the xml text, here is a two record example.

<?xml version="1.0" encoding="UTF-8"?><What_I_Want_Root_Document><What_I_Want_object Text_Item="Diet Root Beer" Cost="0.000000" Cost_To="0.000000" Status="Ongoing Expense"><Categories Category="Food"/><Categories Category="pop"/><Notes Note="No Note"/></What_I_Want_object><What_I_Want_object Text_Item="Coffee Fool Coffee" Cost="0.000000" Cost_To="0.000000" Status="Ongoing Expense"><Categories Category="Food"/><Categories Category="Drink"/><Notes Note="No Note"/></What_I_Want_object></What_I_Want_Root_Document>

my problem is I can not iterate the categories and notes. This is my code for loading, the text_item,status,cost, and cost_to I can iterate out and are ok.

this is my code:

For counter As Integer = 0 To root.ChildCount - 1

// Add Team name or iterate though what_I_want records
teamNode = root.Child(counter)
// What_I_Want_List.AddRow(teamNode.GetAttribute(“Text_Item”))
MessageBox(teamNode.GetAttribute(“Text_Item”))
MessageBox(teamNode.GetAttribute(“Cost”))
MessageBox(teamNode.GetAttribute(“Cost_To”))
MessageBox(teamNode.GetAttribute(“Status”))
var categories_node as xmlnode
categories_node = teamNode.GetAttributeNode(“Categories”)

// // // Add Players
For counter2 As Integer = 0 To categories_node.ChildCount - 1
playerNode = categories_node.Child(counter2)
messagebox(playerNode.GetAttribute(“Category”))
// messagebox((playerNode.GetAttribute(“Category”).ToText)

Next

Next

Any help would be great. Thanks!

Check the XQL will be much faster

Dim nodes As XmlNodeList
nodes = xml.XQL("//notes")

Dim node As XmlNode

For i As Integer = 0 To nodes.Length-1
  node = nodes.Item(i)
  
  If node.Name = "notes" Then
    
    If node.ChildCount > 0 Then
      Dim x As String
      x=node.FirstChild.Value
      TextArea2.AppendText x +EndOfLine
    end
    
    
  Else
  End
  
Next

Thanks. I went back to my code and figured that I was not enumerating the child node(s). Sure enough, when I re-worked my code, I got the xml to load correctly. Not the best way, but it works. Here is what I figured out, it might help some people.

var x as Integer
for x =  0 to teamNode.ChildCount-1
  Var playerNode As XmlNode
  playerNode = teamNode.Child(x)
  DebugWindow.PrintThis(" ")
  DebugWindow.PrintThis(playerNode.Name)
  If playerNode.Name = "Categories" then
    
    MessageBox(playerNode.GetAttribute("Category"))
    DebugWindow.PrintThis(" ")
    DebugWindow.PrintThis(playerNode.GetAttribute("Category"))
  end if
  If playerNode.Name = "Notes" then
    
    MessageBox(playerNode.GetAttribute("Note"))
    DebugWindow.PrintThis(" ")
    DebugWindow.PrintThis(playerNode.GetAttribute("Note"))
  end if
next x