KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test_wEd


1 import java.io.*;
2 import java.util.*;
3 import webEditor.util.*;
4 import webEditor.core.*;
5 import org.w3c.dom.*;
6 import org.apache.regexp.RE;
7
8 import org.apache.xml.serialize.*;
9
10 public class test_wEd
11 {
12     public static void main(String JavaDoc[] args)
13     {
14       Hashtable myTable = new Hashtable();
15
16       myTable.put ("wEd_root", "c:/java/agarcia/webEditor/editors/editor_1");
17       myTable.put ("dataDir", "data");
18       myTable.put ("tplDir", "templates");
19       myTable.put ("homePage", "homePage.xml");
20
21       document myDoc = new document (myTable);
22       //editor myEditor = new editor (myTable);
23

24       //Hashtable myValues = new Hashtable ();
25
//myValues.put ("art_subtitle", "kaka");
26
//myValues.put ("art_body", "mucha kaka");
27

28       //Document doc = myDoc.docRead ("document.xml");
29
//myDoc.writeDoc (myValues, doc, "content");
30
//String myID = myDoc.newDocID ();
31
//Document doc = myDoc.homePageList ();
32
//myDoc.saveFile (myID, doc);
33
//doc = myDoc.docRead (myID);
34
//String outputString = myEditor.showTextEditor (doc , "");
35

36       //myDoc.lowerDoc ("2000/12/27/977939632140.xml");
37
//String fileContent = confFile.readFile ("c:/java/agarcia/webEditor/editors/editor_1/general.xml");
38
configuration myConfig = new configuration ("c:/java/agarcia/webEditor/editors/editor_1/general.xml");
39     String JavaDoc data = myConfig.readValue ("directories", "editorName");
40     System.out.println (data);
41     myConfig.storeValue ("kk", "kulo", "pis");
42     data = myConfig.readValue ("kk", "kulo");
43     System.out.println (data);
44
45     xml_parser confParser = new xml_parser ();
46     // With the content of the hash table, build a DOM tree
47
Document doc = confParser.writeDOM ("general", myConfig.returnData());
48 try {
49     OutputFormat format = new OutputFormat (doc);
50     StringWriter stringOut = new StringWriter ();
51     XMLSerializer serial = new XMLSerializer (stringOut, format);
52     serial.asDOMSerializer ();
53
54     serial.serialize (doc.getDocumentElement());
55         
56       System.out.println (stringOut.toString());
57
58     String JavaDoc templateName = new File
59         ("c:/java/agarcia/webEditor/editors/editor_1" + "/data/templates/config/sample.xsl").getAbsolutePath();
60     templateName = "file:" + templateName;
61     xsl_transform transform = new xsl_transform ();
62     String JavaDoc outputString = transform.processDOM (doc, templateName);
63       System.out.println (outputString);
64
65 }
66 catch (Exception JavaDoc e) {
67     e.printStackTrace();
68     
69 }
70     }
71 }
72
Popular Tags