salve ho scritto questo codice che dovrebbe applicare un foglio di stile .xsl ad un file .xml e creare una pagina risultante in .html
quando la eseguo mi dà "exception in thread "main" java.lang.NoSuchMethodError: main"
nn capisco perché
codice:
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class xslTformer {
private StreamSource xmlSource, xslSheet;
private StreamResult htmlResult;
xslTformer (String xmlFile, String xslFile, String htmlPage) {
try{
xmlSource = new StreamSource(new FileReader(xmlFile));
xslSheet = new StreamSource(new FileReader(xslFile));
htmlResult = new StreamResult(new FileWriter(htmlPage));
} catch(IOException e) {e.printStackTrace();}
}
//Metodo tform()
void tform() throws Throwable{
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer(xslSheet);
transformer.transform(xmlSource, htmlResult);
}
}
class testTransform {
public static void main(String[] args) throws Throwable{
if(args.length != 3) {
System.out.println("Please enter <xmlFile> <xslFile> <htmlPage>");
System.exit(1);
}
xslTformer fileHTML = new xslTformer(args[0],args[1],args[2]);
fileHTML.tform();
}
}