I have an xml data. From this data I need to create objects. Till now I used one class for parsing xml data and managing object state. I can see that cohesion of class is very low. So I want to give parsing responsibility to another class. As a simple idea I may use Factory Pattern for xml parsing and creating objects from xml data(My objects have a common base class). But how should I return created objects to consumer class. Container class object instance(list,map etc.)? One by one(when a node parsed)?
I am open to different desing advices.
You may want to check libraries that do things like this for you. For instance simple: http://simple.sourceforge.net or JAXB: http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding