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