Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 using System;
00040 using XMLStorage;
00041
00042
00043
00044
00045
00046
00047 public class Example1
00048 {
00049
00050
00051
00052 public void testWrite()
00053 {
00054 XMLDoc doc = new XMLDoc();
00055 XMLPos pos = new XMLPos(doc);
00056
00057
00058 pos.create("PARAMS");
00059 pos.create("TEXT");
00060 pos.setContent("Testgruppe\nZeile 2", true);
00061 pos.back();
00062
00063 pos.create("COLOR");
00064 pos.create("RED");
00065 pos.setContent("234");
00066 pos.back();
00067
00068 pos.create("GREEN");
00069 pos.setContent("22");
00070 pos.back();
00071
00072 pos.create("BLUE");
00073 pos.setContent("33");
00074 pos.back();
00075 pos.back();
00076
00077 pos.create("FONT");
00078 pos.create("FONT_FILENAME");
00079 pos.setContent("Arial.ttf");
00080 pos.back();
00081
00082 pos.create("SIZE");
00083 pos.setContent("12");
00084 pos.back();
00085 pos.back();
00086 pos.back();
00087
00088
00089 doc.writeFile("example1.xml");
00090 }
00091
00092
00093
00094
00095
00096 public void testRead()
00097 {
00098 XMLDoc doc = new XMLDoc();
00099
00100
00101 doc.readFile("example1.xml");
00102
00103 string txt = "";
00104 string filename = "";
00105
00106 XMLPos pos = new XMLPos(doc);
00107
00108 if (pos.goDown("PARAMS")) {
00109 if (pos.goDown("TEXT")) {
00110 txt = pos.getContent();
00111 pos.back();
00112 }
00113 pos.back();
00114 }
00115
00116
00117 if (pos.go("PARAMS/FONT/FONT_FILENAME")) {
00118 filename = pos.getContent();
00119 pos.back();
00120 }
00121
00122
00123 System.Console.Out.WriteLine("TEXT: " + txt);
00124 System.Console.Out.WriteLine("font filename: " + filename);
00125
00126
00127 }
00128
00129
00130
00131
00132
00133
00134 static void Main(string[] args)
00135 {
00136 Example1 me = new Example1();
00137
00138 try {
00139 me.testWrite();
00140 me.testRead();
00141 } catch(Exception e) {
00142 System.Console.Error.WriteLine(e);
00143 System.Console.Error.WriteLine(e.StackTrace);
00144 }
00145 }
00146 }