1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.overturetool.api.xml;
15
16
17
18
19
20 import jp.co.csk.vdm.toolbox.VDM.*;
21 import java.util.*;
22
23
24
25
26 public abstract class XmlEvent {
27
28
29 static UTIL.VDMCompare vdmComp = new UTIL.VDMCompare();
30
31
32
33 private Vector estack = null;
34
35
36
37
38 private void vdm_init_XmlEvent () throws CGException {
39 try {
40 estack = new Vector();
41 }
42 catch (Exception e){
43
44 e.printStackTrace(System.out);
45 System.out.println(e.getMessage());
46 }
47 }
48
49
50
51
52 public XmlEvent () throws CGException {
53 vdm_init_XmlEvent();
54 }
55
56
57
58
59 protected void pushEntity (final XmlEntity ppe) throws CGException {
60
61 Vector rhs_2 = null;
62 Vector var1_3 = null;
63 var1_3 = new Vector();
64 var1_3.add(ppe);
65 rhs_2 = (Vector) var1_3.clone();
66 rhs_2.addAll(estack);
67 estack = (Vector) UTIL.ConvertToList(UTIL.clone(rhs_2));
68 }
69
70
71
72
73 protected XmlEntity popEntity () throws CGException {
74
75 XmlEntity res = (XmlEntity) estack.get(0);
76 estack = (Vector) UTIL.ConvertToList(UTIL.clone(new Vector(estack.subList(1, estack.size()))));
77 return (XmlEntity) res;
78 }
79
80
81
82
83 protected XmlEntity peekEntity () throws CGException {
84 return (XmlEntity) (XmlEntity) estack.get(0);
85 }
86
87
88
89
90 protected Long stackDepth () throws CGException {
91 return new Long(estack.size());
92 }
93
94
95
96
97 abstract protected Boolean StartDocument () throws CGException ;
98
99
100
101
102 abstract protected Boolean StopDocument () throws CGException ;
103
104
105
106
107 abstract protected Boolean StartEntity (final String var_1_1) throws CGException ;
108
109
110
111
112 abstract protected Boolean StopEntity (final String var_1_1) throws CGException ;
113
114
115
116
117 abstract protected Boolean StartAttribute (final String var_1_1, final String var_2_2) throws CGException ;
118
119
120
121
122 abstract protected Boolean StartData (final String var_1_1) throws CGException ;
123
124
125
126
127 public void parse (final String fname) throws CGException {
128
129 XmlParser parser = new XmlParser(fname, this);
130 parser.parse();
131 }
132
133
134 }
135 ;