001: /* this file is generated by RelaxNGCC */
002: package com.sun.tools.jxc.gen.config;
003:
004: import org.xml.sax.SAXException;
005: import org.xml.sax.Attributes;
006: import com.sun.tools.jxc.NGCCRuntimeEx;
007:
008: import java.util.List;
009: import java.util.ArrayList;
010: import java.io.File;
011:
012: public class Config extends NGCCHandler {
013: private String bd;
014: private Schema _schema;
015: protected final NGCCRuntimeEx $runtime;
016: private int $_ngcc_current_state;
017: protected String $uri;
018: protected String $localName;
019: protected String $qname;
020:
021: public final NGCCRuntime getRuntime() {
022: return ($runtime);
023: }
024:
025: public Config(NGCCHandler parent, NGCCEventSource source,
026: NGCCRuntimeEx runtime, int cookie) {
027: super (source, parent, cookie);
028: $runtime = runtime;
029: $_ngcc_current_state = 8;
030: }
031:
032: public Config(NGCCRuntimeEx runtime) {
033: this (null, runtime, runtime, -1);
034: }
035:
036: private void action0() throws SAXException {
037: this .schema.add(_schema);
038: }
039:
040: private void action1() throws SAXException {
041: baseDir = $runtime.getBaseDir(bd);
042: }
043:
044: public void enterElement(String $__uri, String $__local,
045: String $__qname, Attributes $attrs) throws SAXException {
046: int $ai;
047: $uri = $__uri;
048: $localName = $__local;
049: $qname = $__qname;
050: switch ($_ngcc_current_state) {
051: case 0: {
052: revertToParentFromEnterElement(this , super ._cookie, $__uri,
053: $__local, $__qname, $attrs);
054: }
055: break;
056: case 1: {
057: if (($__uri == "" && $__local == "schema")) {
058: NGCCHandler h = new Schema(this , super ._source,
059: $runtime, 3, baseDir);
060: spawnChildFromEnterElement(h, $__uri, $__local,
061: $__qname, $attrs);
062: } else {
063: unexpectedEnterElement($__qname);
064: }
065: }
066: break;
067: case 8: {
068: if (($__uri == "" && $__local == "config")) {
069: $runtime.onEnterElementConsumed($__uri, $__local,
070: $__qname, $attrs);
071: $_ngcc_current_state = 7;
072: } else {
073: unexpectedEnterElement($__qname);
074: }
075: }
076: break;
077: case 2: {
078: if (($__uri == "" && $__local == "schema")) {
079: NGCCHandler h = new Schema(this , super ._source,
080: $runtime, 4, baseDir);
081: spawnChildFromEnterElement(h, $__uri, $__local,
082: $__qname, $attrs);
083: } else {
084: $_ngcc_current_state = 1;
085: $runtime.sendEnterElement(super ._cookie, $__uri,
086: $__local, $__qname, $attrs);
087: }
088: }
089: break;
090: case 7: {
091: if (($ai = $runtime.getAttributeIndex("", "baseDir")) >= 0) {
092: $runtime.consumeAttribute($ai);
093: $runtime.sendEnterElement(super ._cookie, $__uri,
094: $__local, $__qname, $attrs);
095: } else {
096: unexpectedEnterElement($__qname);
097: }
098: }
099: break;
100: case 4: {
101: if (($__uri == "" && $__local == "classes")) {
102: NGCCHandler h = new Classes(this , super ._source,
103: $runtime, 6);
104: spawnChildFromEnterElement(h, $__uri, $__local,
105: $__qname, $attrs);
106: } else {
107: unexpectedEnterElement($__qname);
108: }
109: }
110: break;
111: default: {
112: unexpectedEnterElement($__qname);
113: }
114: break;
115: }
116: }
117:
118: public void leaveElement(String $__uri, String $__local,
119: String $__qname) throws SAXException {
120: int $ai;
121: $uri = $__uri;
122: $localName = $__local;
123: $qname = $__qname;
124: switch ($_ngcc_current_state) {
125: case 0: {
126: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
127: $__local, $__qname);
128: }
129: break;
130: case 1: {
131: if (($__uri == "" && $__local == "config")) {
132: $runtime.onLeaveElementConsumed($__uri, $__local,
133: $__qname);
134: $_ngcc_current_state = 0;
135: } else {
136: unexpectedLeaveElement($__qname);
137: }
138: }
139: break;
140: case 2: {
141: $_ngcc_current_state = 1;
142: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
143: $__qname);
144: }
145: break;
146: case 7: {
147: if (($ai = $runtime.getAttributeIndex("", "baseDir")) >= 0) {
148: $runtime.consumeAttribute($ai);
149: $runtime.sendLeaveElement(super ._cookie, $__uri,
150: $__local, $__qname);
151: } else {
152: unexpectedLeaveElement($__qname);
153: }
154: }
155: break;
156: default: {
157: unexpectedLeaveElement($__qname);
158: }
159: break;
160: }
161: }
162:
163: public void enterAttribute(String $__uri, String $__local,
164: String $__qname) throws SAXException {
165: $uri = $__uri;
166: $localName = $__local;
167: $qname = $__qname;
168: switch ($_ngcc_current_state) {
169: case 0: {
170: revertToParentFromEnterAttribute(this , super ._cookie,
171: $__uri, $__local, $__qname);
172: }
173: break;
174: case 2: {
175: $_ngcc_current_state = 1;
176: $runtime.sendEnterAttribute(super ._cookie, $__uri,
177: $__local, $__qname);
178: }
179: break;
180: case 7: {
181: if (($__uri == "" && $__local == "baseDir")) {
182: $_ngcc_current_state = 6;
183: } else {
184: unexpectedEnterAttribute($__qname);
185: }
186: }
187: break;
188: default: {
189: unexpectedEnterAttribute($__qname);
190: }
191: break;
192: }
193: }
194:
195: public void leaveAttribute(String $__uri, String $__local,
196: String $__qname) throws SAXException {
197: $uri = $__uri;
198: $localName = $__local;
199: $qname = $__qname;
200: switch ($_ngcc_current_state) {
201: case 0: {
202: revertToParentFromLeaveAttribute(this , super ._cookie,
203: $__uri, $__local, $__qname);
204: }
205: break;
206: case 2: {
207: $_ngcc_current_state = 1;
208: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
209: $__local, $__qname);
210: }
211: break;
212: case 5: {
213: if (($__uri == "" && $__local == "baseDir")) {
214: $_ngcc_current_state = 4;
215: } else {
216: unexpectedLeaveAttribute($__qname);
217: }
218: }
219: break;
220: default: {
221: unexpectedLeaveAttribute($__qname);
222: }
223: break;
224: }
225: }
226:
227: public void text(String $value) throws SAXException {
228: int $ai;
229: switch ($_ngcc_current_state) {
230: case 6: {
231: bd = $value;
232: $_ngcc_current_state = 5;
233: action1();
234: }
235: break;
236: case 0: {
237: revertToParentFromText(this , super ._cookie, $value);
238: }
239: break;
240: case 2: {
241: $_ngcc_current_state = 1;
242: $runtime.sendText(super ._cookie, $value);
243: }
244: break;
245: case 7: {
246: if (($ai = $runtime.getAttributeIndex("", "baseDir")) >= 0) {
247: $runtime.consumeAttribute($ai);
248: $runtime.sendText(super ._cookie, $value);
249: }
250: }
251: break;
252: }
253: }
254:
255: public void onChildCompleted(Object $__result__, int $__cookie__,
256: boolean $__needAttCheck__) throws SAXException {
257: switch ($__cookie__) {
258: case 3: {
259: _schema = ((Schema) $__result__);
260: action0();
261: $_ngcc_current_state = 1;
262: }
263: break;
264: case 4: {
265: _schema = ((Schema) $__result__);
266: action0();
267: $_ngcc_current_state = 1;
268: }
269: break;
270: case 6: {
271: classes = ((Classes) $__result__);
272: $_ngcc_current_state = 2;
273: }
274: break;
275: }
276: }
277:
278: public boolean accepted() {
279: return (($_ngcc_current_state == 0));
280: }
281:
282: private File baseDir;
283: private Classes classes;
284: private List schema = new ArrayList();
285:
286: public Classes getClasses() {
287: return this .classes;
288: }
289:
290: public File getBaseDir() {
291: return baseDir;
292: }
293:
294: public List getSchema() {
295: return this.schema;
296: }
297:
298: }
|