I have a xml file which Im reading it from my class
new SomeClass1()
new SomeClass2()
You may want to use simple Java Libraries such as XStream, which is very simple to use. All you need to define a POJO class to hold the parse values from XML and then use the library to parse the XML and produce the converted java objects for you.
XStream xstream = new XStream();
//converting object to XML
String xml = xstream.toXML(myObject);
//converting xml to object
MyClass myObject = (MyClass)xstream.fromXML(xml);
Please have a look at its two minutes tutorial.
its something like that i imagine
DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc = db.parse("name_of_file.xml");
Element rootElement = doc.getDocumentElement();
NodeList nl=rootElement.getElementsByTagName("TestClass");