1 package org.catacomb.serial.quickxml;
2
3 import org.catacomb.util.FileUtil;
4
5 import java.io.File;
6
7
8
9
10 public class XMLFileElement extends Element {
11
12 File felt;
13
14
15
16 public XMLFileElement(File fdir, String enm) {
17 super(enm);
18 if (fdir.exists()) {
19
20 } else {
21 fdir.mkdirs();
22 }
23
24 felt = new File(fdir, enm + ".xml");
25
26 if (felt.exists()) {
27 String s = FileUtil.readStringFromFile(felt);
28 populateFrom(s);
29
30 } else {
31 sync();
32 }
33
34
35 }
36
37
38
39 public void sync() {
40 String s = dump();
41 FileUtil.writeStringToFile(s, felt);
42 }
43
44
45
46
47 }