1
2
3
4
5
6
7
8 package com.buckosoft.PicMan.dom;
9
10 import java.io.File;
11 import java.util.Iterator;
12 import java.util.List;
13
14 import org.dom4j.Document;
15 import org.dom4j.DocumentHelper;
16 import org.dom4j.Element;
17
18
19
20
21 public class ImportPicsDom {
22
23
24
25
26
27 static public Document createDocument(List<File> pics) {
28 Document document = DocumentHelper.createDocument();
29 Element root = document.addElement("ImportPicsNames");
30 Iterator<File> iter = pics.iterator();
31 while (iter.hasNext()) {
32 File f = iter.next();
33 Element ele = DocumentHelper.createElement("File");
34 ele.addElement("name").addText(f.getName());
35 ele.addElement("date").addText("" + (f.lastModified()));
36 root.add(ele);
37 }
38 return(document);
39 }
40
41
42
43
44
45
46
47 static public Document createDocument(String name, int istatus, String status) {
48 Document document = DocumentHelper.createDocument();
49 Element root = document.addElement("ImportPicReturn");
50 root.addElement("name").addText(name);
51 root.addElement("istatus").addText("" + istatus);
52 root.addElement("status").addText(status);
53 return(document);
54 }
55 }