Re: execute file through servlet

Michael Peceny <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
The following should work (just an abbreviated code snippet):

    String xml = <<your XML string>>;
    PrintWriter out = response.getWriter();
    Transformer transformer = <<obtain transformer for your stylesheet
here>>;
    StringReader srin = new StringReader( xml );
    transformer.transform( new StreamSource((Reader)srin), new
StreamResult(out) );
    srin.close();
    out.close();

Regards
Michael

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> Sent: Donnerstag, 6. Marz 2003 11:41
> To: [email protected]
> Subject: execute file through servlet
>
>
> I need that an  XML could be transformed while the XSL is
> phisically on the web server.
> I have already created the xml file as a string but how can i
> use that string to be transformed?
> The TransformFactory doesnt work with string, as the
> following code works for tranformation!
> I have xml either as a string or document, but I dont know
> the transformation to use!
> Regards
>         Roberto

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.