I have learned a tutorial about SAX parser of java and now I need to create tree list of XML file like this:
<course>
<chapter>
<title>chapter one of course one</title>
<content> .... </content>
</chapter>
<chapter>
<title>chapter two of course one</title>
<content> .... </content>
</chapter>
</course>
and then I what to create data structure like this:
string lessons[][] = {
{"chapter one of course one", "chapter two of course one"},
{"chapter one of course two", "chapter two of course two", "chapter tree of course two"},
....
....
}
There is no out-of-box support in JDK for the kind of data structure you are looking for. What you need is a Multimap. Guava library provides this data structure. You can either use that library (I recommend) or build your own.
Also, make sure you read my answer in this SO post if your are reading element content using SAX.