//package com.abnamro.infinity.servlet; import java.io.*; import java.net.*; import java.util.*; import com.ibm.xml.parser.*; import org.w3c.dom.*; import com.lotus.xsl.*; import com.lotus.xsl.xml4j.*; import javax.servlet.*; import javax.servlet.http.*; public class xml2html extends HttpServlet { public void init(ServletConfig config) throws ServletException { super.init(config); // Right now there is nothing to do herex } public void destroy() { super.destroy(); // And, nothing to do here yet, either } protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doRequest_(req, resp); } protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doRequest_(req, resp); } // Purposely do not implement doPut - no ftp-like interface yet // Purposely do not implement doDelete - no delete interface yet private void doRequest_(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String xmlFileName = req.getParameter(XML_); String xslFileName = req.getParameter(XSL_); PrintWriter printer = new PrintWriter(resp.getWriter()); if (xmlFileName != null && xslFileName != null) { resp.setContentType("text/html"); process(xmlFileName, xslFileName, printer); } else { resp.setContentType("text/html"); resp.getWriter().write("Mistake in Request"); resp.getWriter().write("

Mistake in using xml2html

"); resp.getWriter().write("XML and XSL are both required parameters to the servlet"); } } public void process(String inputFileName, String xslFileName, PrintWriter pr) { String a=" GNU Coding Standards
This should be section 1

The title page of the manual should state the version of the program which the manual applies to. The Top node of the manual should also contain this information. If the manual is changing more frequently than or independent of the program, also state a version number for the manual in both of these places.

This should be section 2

The title page of the manual should state the version of the program which the manual applies to. The Top node of the manual should also contain this information. If the manual is changing more frequently than or independent of the program, also state a version number for the manual in both of these places.

This should be section 2.1

The title page of the manual should state the version of the program which the manual applies to. The Top node of the manual should also contain this information. If the manual is changing more frequently than or independent of the program, also state a version number for the manual in both of these places.

This should be section 2.2.2

The title page of the manual should state the version of the program which the manual applies to. The Top node of the manual should also contain this information. If the manual is changing more frequently than or independent of the program, also state a version number for the manual in both of these places.

"; StringReader sr= new StringReader(a); boolean anErrorOccurred = false; ProcessXSL xmlProcessorLiason = null; XSLProcessor p = null; try { xmlProcessorLiason = new ProcessXSL(); xmlProcessorLiason.m_use_validation = false; p = new XSLProcessor(xmlProcessorLiason); try { String resultns = new String("DEBUG"); // DEBUG marks error messages //p.process(inputFileName, xslFileName, resultns, pr); // Process to our print writer here p.process(a, xslFileName, resultns, pr); // Process to our print writer here } catch (Exception e) { e.printStackTrace(pr); // Post our exception back to the web page } } catch (Exception e) { e.printStackTrace(pr); // Post our exception back to the web page } } public static void main(String [] argv) { xml2html x = new xml2html(); PrintWriter printer = new PrintWriter(System.out); x.process(argv[0], argv[1], printer); } private static final String XML_ = "XML"; private static final String XSL_ = "XSL"; }