Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xml transform problem

1 view
Skip to first unread message

Vlamos

unread,
Oct 2, 2004, 6:11:53 AM10/2/04
to
Hello,

I have a servlet that transforms a XML and XSL file into a HTML page.
So the servlet uses 2 files on the server. Now I want to use an XML
file that is generated by a php script on a different server.

This is a part of the code :

public void transformToHtml(String xmlFileName, HttpServletResponse res) {

try {
//create xmlSource
Source xmlSource = new StreamSource(xmlFileName);

PrintWriter out = res.getWriter();
//do the actual transformation on the XML source and
//send output through ServletOutputStream
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(xmlSource, new StreamResult(out));

} catch (TransformerConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TransformerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}


So the transformToHTML takes a xmlfile and the servlet response to write
to... But how can I use an URL as file? Do I have to retrieve the file,
store it as a XML file and transform it?

Thanks !


Tom

0 new messages