2 * Created on Jun 30, 2005
4 * TODO To change the template for this generated file go to Window -
5 * Preferences - Java - Code Style - Code Templates
7 package isac.util.genhtml;
9 import isac.util.InformationProcessor;
11 import java.io.BufferedInputStream;
12 import java.io.FileInputStream;
13 import java.io.FileReader;
14 import java.io.FileWriter;
15 import java.io.IOException;
16 import java.io.StringReader;
18 import javax.xml.transform.Source;
19 import javax.xml.transform.stream.StreamSource;
21 import com.sun.corba.se.internal.javax.rmi.CORBA.Util;
23 import junit.framework.TestCase;
28 * TODO To change the template for this generated type comment go to Window -
29 * Preferences - Java - Code Style - Code Templates
31 public class TestStyleSheets extends TestCase {
33 String test_destination_ = "/netshares/studenthomes/mlang/test_xml_file/";
36 * @author ML creating one single html-file out of xml-file
39 public void testCreateHtml() {
41 .println("---BEGIN isac.util.genhtml.start.TestStyleSheets#testCreateHtml");
42 System.out.println("creating html_file");
46 Source xslSource = null;
47 Source xmlSource = null;
49 String header = "<?xml version=\"1.0\"?> \n"
50 + "<?xml-stylesheet href=\"http://pear.math.pitt.edu/mathzilla/Examples/mml.css\" type=\"text/css\"?>\n"
51 + "<!DOCTYPE html SYSTEM \"mathml.dtd_\">\n" +
52 //"<?xml-stylesheet type=\"text/xsl\"
53 // href=\"http://www.w3.org/Math/XSL/pmathml.xsl\"?>\n"+
54 //" <HTML xmlns=\"http://www.w3.org/1999/xhtml\">\n"+
55 "<HTML xmlns=\"http://www.w3.org/1999/xhtml\"\n"
56 + "xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n"
57 + "xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n" + "<BODY>";
59 String footer = "</BODY>\n</HTML>";
61 String destination = "/netshares/studenthomes/mlang/test_xml_file/test";
62 String destination_xml = "/netshares/studenthomes/mlang/test_xml_file/exp/exp_IsacCore_Tests_1b.xml";
66 out = new FileWriter(destination + ".html");
68 FileInputStream xml_source = new FileInputStream(destination_xml);
69 int lenght= xml_source.available();
70 byte buffer[]= new byte[lenght];
71 xml_source.read(buffer);
72 String content_xml_file = new String(buffer);
74 xmlSource = new StreamSource(new StringReader(content_xml_file));
75 xslSource = new StreamSource(getClass().getResourceAsStream(
76 //"/netshares/studenthomes/mlang/test_xml_file/exp/exp_hcontent.xsl"));
77 "/isac/util/genhtml/templates/pbl_node_content.xsl"));
80 Encoder.encodeInformation(xslSource, xmlSource, out);
86 } catch (IOException e) {
90 assertEquals("TODO", "TODO");
92 .println("---END isac.util.genhtml.end.TestStyleSheet#testCreateHtml");