0

I'd like to get the info from xml file just once, on Awake, so I want to put all the xml info into a matrix. Not just in a ArrayList, but in a hashtable matrix with the name of each parent and child.

I've found nothing about it, so I'm trying by myself.

I thought to declare just one Hashtable in the beginning, because I don't have to know how much info is in the XML. And then, put hastables into another hashtables. For example:

private Hastable matrix = new Hashtable();

for(...){
    matrix[i] = new hashtable();
    for(...){
        matrix[i][j] = value;
    }
}

But I get an error in "matrix[i][j]".

Dictionary doesn't work, because I have to define the type of variables. Dictionary, but I want to make it for any xml structure.

Sorry for the code, I'm writting from the phone. XD

Pablojota
  • 1
  • 1
  • 2
  • 2
    [You probably want to use the generic `Dictionary` instead oh `Hashtable`.](http://stackoverflow.com/questions/301371/why-is-dictionary-preferred-over-hashtable) – Gareth Latty May 18 '14 at 13:24
  • But, how? Dictionary needs two arguments (string, string) or (new dictionary, string), etc... I don't know xml structure. The thing is, I need a matrix (I think), but is difficult, without know the xml structure... – Pablojota May 18 '14 at 13:32
  • If you are storing arbitrary values, you can use `Dictionary` - it just means that the type safety gets enforced by the compiler. – Gareth Latty May 18 '14 at 13:34
  • Ok, I'll try later. Thank you. – Pablojota May 18 '14 at 13:36

0 Answers0