Guys,
I am working on my java project, replaced by existing factory properties file into xml file. now i need to call that xml file from my factory using DOM parser.
I am little confused with how to replace the exisitng factory code to access xml.

These are my codes

My exisitng factory:
------------------

package services;
import utility.*;

import exception.ServiceLoadException;
import org.apache.log4j.*;

public class Factory {

private static Logger logger = Logger.getLogger(Factory.class);

private Factory() {
}
private static Factory factory = new Factory();

public static Factory getInstance() {
return factory;
}

public IService getService(String serviceName) throws ServiceLoadException {
logger.info("Getting service from factory now");
try {
@SuppressWarnings("rawtypes")


Class c = Class.forName(getImplName(serviceName));
return (IService) c.newInstance();
} catch (Exception e) {
throw new ServiceLoadException(serviceName + "not loaded");
}
}

private String getImplName(String serviceName) throws Exception {
java.util.Properties props = new java.util.Properties();
java.io.FileInputStream fis = new java.io.FileInputStream(
"config/properties.txt");
props.load(fis);
fis.close();
return props.getProperty(serviceName);
}
}


My new parser Class:
-----------------------

public class parser {

private static Logger logger = Logger.getLogger(parser.class);
public static void buildDom(){
//create factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

try{
//create parser
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(new FileInputStream("services/properties.xml"));

//create DOM tree
Element root = document.getDocumentElement();
System.out.println("root element is:" +root);

String attrib = root.getAttribute("CustomerServiceHibernateImpl");
}catch (Exception e){
logger.info("INFO - cant parse file");
System.err.println("Exception: " + e.getMessage());
e.printStackTrace();
}

}}

My new XML file:
------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-properties PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<ICustomerService> services.CustomerServiceHibernateImpl </ICustomerService>
</hibernate-configuration>

what codes do i need to modify in my factory to access xml file thru parser class? i am new to java, still struggling with all these concepts.

Plzzz help!!!