Escrever em arquivo jsp

0 respostas
V

Estou tentando gerar um arquivo html apartir de um arquivo xml.

De onde veio o seguinte codigo.

<%@ page language="java" import= "java.io.*, javax.xml.transform.*, javax.xml.transform.stream.*" %>



<%
	File xmlFile = new File("C:\\Arquivos de programas\\Apache Software Foundation\\Tomcat 6.0\\webapps\\teste\\change\\res\\Login.xml");
	File xsltFile = new File("C:\\Arquivos de programas\\Apache Software Foundation\\Tomcat 6.0\\webapps\\teste\\change\\res\\Login.xls");
	Source xmlSource = new StreamSource(xmlFile);
	Source xsltSource = new StreamSource(xsltFile);
	TransformerFactory transFact = TransformerFactory.newInstance();
	try {
		Templates cachedXSLT = transFact.newTemplates(xsltSource);
		Transformer trans = cachedXSLT.newTransformer();
		trans = transFact.newTransformer(xsltSource);
		trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		trans.setOutputProperty(OutputKeys.INDENT, "yes");
		trans.setOutputProperty(OutputKeys.METHOD, "html");
		try {
			trans.transform(xmlSource, new StreamResult(new FileOutputStream("C:\\Arquivos de programas\\Apache Software Foundation\\Tomcat 6.0\\webapps\\teste\\Login.html")));
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Unpossible to write in file");
		} 
	}catch (TransformerConfigurationException e) {
		e.printStackTrace();
		}
%>

Porém este código nao escreve no arquivo html. Alguem pode me ajudar?

Desde já o meu mto obrigado.

Criado 6 de agosto de 2008
Respostas 0
Participantes 1