1
2
3
4
5 package hoplugins.conv;
6
7
8
9 import java.io.File;
10
11 import javax.swing.JOptionPane;
12
13 import org.w3c.dom.Document;
14 import org.w3c.dom.Element;
15 import org.w3c.dom.NodeList;
16
17
18 /***
19 * @author Thorsten Dietz
20 *
21 */
22 public class HAM extends HrfMaker {
23
24 protected HAM(){
25 type = "HAM";
26 }
27
28 protected void start(File[] xmls,File targetDir) {
29 Document doc = null;
30 try {
31
32 for (int i = 0; i < xmls.length; i++) {
33 clearArrays();
34 addBasics();
35 doc = getDocument(xmls[i]);
36 analyze(doc.getDocumentElement().getChildNodes());
37 writeHrf(xmls[i].getName().substring(3,11), targetDir);
38 }
39 JOptionPane.showMessageDialog(null, RSC.getProperty("finished"));
40 } catch (Exception e1) {
41 handleException(e1, RSC.PROP_DEFAULT_ERROR_MESSAGE);
42 }
43 }
44
45
46 private void analyze(NodeList nodelist){
47
48 for (int i = 0; i < nodelist.getLength(); i++) {
49 if (nodelist.item(i) instanceof Element) {
50 Element element = (Element) nodelist.item(i);
51
52 if (element.getTagName().equals("TeamDetails")) {
53 analyzeTeamDetails(nodelist.item(i).getChildNodes());
54 }
55 if (element.getTagName().equals("Players")) {
56 initPlayersArray(nodelist.item(i).getChildNodes());
57
58 }
59 if (element.getTagName().equals("Economy")) {
60 analyzeEconomy(nodelist.item(i).getChildNodes());
61 }
62 if (element.getTagName().equals("Club")) {
63 analyzeClub(nodelist.item(i).getChildNodes());
64 }
65 if (element.getTagName().equals("Training")) {
66 analyzeTraining(nodelist.item(i).getChildNodes());
67 }
68 if (element.getTagName().equals("Arena")) {
69 analyzeArena(nodelist.item(i).getChildNodes());
70 }
71 if (element.getTagName().equals("WorldDetails")) {
72 analyzeWorldDetail(nodelist.item(i).getChildNodes());
73 }
74
75 }
76 }
77
78
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109 }