I have created a class with 3 sub classes in Java. The 3 sub classes contain variables to store information from my XML document. I am able to store in the first two for there are only single instances of the data in the XML. The third class contains variables that repeat multiple times. I want to store an object of “third class” objects. I also have a SAX parser class. I am doing this within an Android environment (1.6).
Does this make enough sense without displaying any code?
Could you try to explain your model a bit more? it’s kind of hard to understand what you’re trying to do without a more concrete example. What are the three sub-classes called, and how do they relate to each other? An XML snippet or two might help, as well.
From what I understood from your question, though, my guess is that you should use some sort of Factory pattern to create “third-class” objects. So, when your SAX parser hits the appropriate tag, call the factory method with the attributes you’ve just parsed to create the object.