Hi, I have a requirement in my project. I have a xml template file which holds information like class name, and its properties with datatype. My requirement is to dynamically create a class from this XML so that I can create instance for the same.
You could use a DOM parser to parse the XML file and get all the information required. Then you could create the corresponding .java file (as a text file) with the information obtained. Then you could use the com.sun.tools.javac.Main class to compile this newly created .java file into a .class file. Then you could use the Class.forName() method to load the class (of course the root folder of the generated .class file must be in the class path).