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 [] 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 24 28 36 configuration myConfig = new configuration ("c:/java/agarcia/webEditor/editors/editor_1/general.xml"); 39 String 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 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 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 outputString = transform.processDOM (doc, templateName); 63 System.out.println (outputString); 64 65 } 66 catch (Exception e) { 67 e.printStackTrace(); 68 69 } 70 } 71 } 72
| Popular Tags
|