Well for 1) this is pretty much exactly what is being done in my example code. The difference is that it prints out the content of "data". (But I put the index of each child into that "data" varialbe)
My suggestion is that you insert a new field in the MyNode type, this variable can then hold an index. E. g. for child1 this index is 1, etc. Then do the same thing my example does in the end, but print out this index instead of data. I think you should try implementing this on you own, it will probably help you understand what is going on in the code. If you have problems doing so you can come back with more questions. Cheers, Andre
