001: /* this file is generated by RelaxNGCC */
002: package com.sun.xml.xsom.impl.parser.state;
003:
004: import org.xml.sax.SAXException;
005: import org.xml.sax.XMLReader;
006: import org.xml.sax.Attributes;
007: import com.sun.xml.xsom.impl.parser.NGCCRuntimeEx;
008:
009: import com.sun.xml.xsom.*;
010: import com.sun.xml.xsom.parser.*;
011: import com.sun.xml.xsom.impl.*;
012: import com.sun.xml.xsom.impl.parser.*;
013: import org.xml.sax.Locator;
014: import org.xml.sax.ContentHandler;
015: import org.xml.sax.helpers.*;
016: import java.util.*;
017:
018: class importDecl extends NGCCHandler {
019: private String ns;
020: private String schemaLocation;
021: protected final NGCCRuntimeEx $runtime;
022: private int $_ngcc_current_state;
023: protected String $uri;
024: protected String $localName;
025: protected String $qname;
026:
027: public final NGCCRuntime getRuntime() {
028: return ($runtime);
029: }
030:
031: public importDecl(NGCCHandler parent, NGCCEventSource source,
032: NGCCRuntimeEx runtime, int cookie) {
033: super (source, parent, cookie);
034: $runtime = runtime;
035: $_ngcc_current_state = 12;
036: }
037:
038: public importDecl(NGCCRuntimeEx runtime) {
039: this (null, runtime, runtime, -1);
040: }
041:
042: private void action0() throws SAXException {
043:
044: if (ns == null)
045: ns = "";
046: $runtime.importSchema(ns, schemaLocation);
047:
048: }
049:
050: public void enterElement(String $__uri, String $__local,
051: String $__qname, Attributes $attrs) throws SAXException {
052: int $ai;
053: $uri = $__uri;
054: $localName = $__local;
055: $qname = $__qname;
056: switch ($_ngcc_current_state) {
057: case 12: {
058: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
059: .equals("import"))) {
060: $runtime.onEnterElementConsumed($__uri, $__local,
061: $__qname, $attrs);
062: $_ngcc_current_state = 8;
063: } else {
064: unexpectedEnterElement($__qname);
065: }
066: }
067: break;
068: case 4: {
069: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
070: $runtime.consumeAttribute($ai);
071: $runtime.sendEnterElement(super ._cookie, $__uri,
072: $__local, $__qname, $attrs);
073: } else {
074: $_ngcc_current_state = 2;
075: $runtime.sendEnterElement(super ._cookie, $__uri,
076: $__local, $__qname, $attrs);
077: }
078: }
079: break;
080: case 2: {
081: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
082: .equals("annotation"))) {
083: NGCCHandler h = new annotation(this , super ._source,
084: $runtime, 3, null, AnnotationContext.SCHEMA);
085: spawnChildFromEnterElement(h, $__uri, $__local,
086: $__qname, $attrs);
087: } else {
088: $_ngcc_current_state = 1;
089: $runtime.sendEnterElement(super ._cookie, $__uri,
090: $__local, $__qname, $attrs);
091: }
092: }
093: break;
094: case 8: {
095: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
096: $runtime.consumeAttribute($ai);
097: $runtime.sendEnterElement(super ._cookie, $__uri,
098: $__local, $__qname, $attrs);
099: } else {
100: $_ngcc_current_state = 4;
101: $runtime.sendEnterElement(super ._cookie, $__uri,
102: $__local, $__qname, $attrs);
103: }
104: }
105: break;
106: case 0: {
107: revertToParentFromEnterElement(this , super ._cookie, $__uri,
108: $__local, $__qname, $attrs);
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 4: {
126: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
127: $runtime.consumeAttribute($ai);
128: $runtime.sendLeaveElement(super ._cookie, $__uri,
129: $__local, $__qname);
130: } else {
131: $_ngcc_current_state = 2;
132: $runtime.sendLeaveElement(super ._cookie, $__uri,
133: $__local, $__qname);
134: }
135: }
136: break;
137: case 2: {
138: $_ngcc_current_state = 1;
139: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
140: $__qname);
141: }
142: break;
143: case 8: {
144: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
145: $runtime.consumeAttribute($ai);
146: $runtime.sendLeaveElement(super ._cookie, $__uri,
147: $__local, $__qname);
148: } else {
149: $_ngcc_current_state = 4;
150: $runtime.sendLeaveElement(super ._cookie, $__uri,
151: $__local, $__qname);
152: }
153: }
154: break;
155: case 1: {
156: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
157: .equals("import"))) {
158: $runtime.onLeaveElementConsumed($__uri, $__local,
159: $__qname);
160: $_ngcc_current_state = 0;
161: action0();
162: } else {
163: unexpectedLeaveElement($__qname);
164: }
165: }
166: break;
167: case 0: {
168: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
169: $__local, $__qname);
170: }
171: break;
172: default: {
173: unexpectedLeaveElement($__qname);
174: }
175: break;
176: }
177: }
178:
179: public void enterAttribute(String $__uri, String $__local,
180: String $__qname) throws SAXException {
181: int $ai;
182: $uri = $__uri;
183: $localName = $__local;
184: $qname = $__qname;
185: switch ($_ngcc_current_state) {
186: case 4: {
187: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
188: $_ngcc_current_state = 6;
189: } else {
190: $_ngcc_current_state = 2;
191: $runtime.sendEnterAttribute(super ._cookie, $__uri,
192: $__local, $__qname);
193: }
194: }
195: break;
196: case 2: {
197: $_ngcc_current_state = 1;
198: $runtime.sendEnterAttribute(super ._cookie, $__uri,
199: $__local, $__qname);
200: }
201: break;
202: case 8: {
203: if (($__uri.equals("") && $__local.equals("namespace"))) {
204: $_ngcc_current_state = 10;
205: } else {
206: $_ngcc_current_state = 4;
207: $runtime.sendEnterAttribute(super ._cookie, $__uri,
208: $__local, $__qname);
209: }
210: }
211: break;
212: case 0: {
213: revertToParentFromEnterAttribute(this , super ._cookie,
214: $__uri, $__local, $__qname);
215: }
216: break;
217: default: {
218: unexpectedEnterAttribute($__qname);
219: }
220: break;
221: }
222: }
223:
224: public void leaveAttribute(String $__uri, String $__local,
225: String $__qname) throws SAXException {
226: int $ai;
227: $uri = $__uri;
228: $localName = $__local;
229: $qname = $__qname;
230: switch ($_ngcc_current_state) {
231: case 9: {
232: if (($__uri.equals("") && $__local.equals("namespace"))) {
233: $_ngcc_current_state = 4;
234: } else {
235: unexpectedLeaveAttribute($__qname);
236: }
237: }
238: break;
239: case 4: {
240: $_ngcc_current_state = 2;
241: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
242: $__local, $__qname);
243: }
244: break;
245: case 2: {
246: $_ngcc_current_state = 1;
247: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
248: $__local, $__qname);
249: }
250: break;
251: case 8: {
252: $_ngcc_current_state = 4;
253: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
254: $__local, $__qname);
255: }
256: break;
257: case 5: {
258: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
259: $_ngcc_current_state = 2;
260: } else {
261: unexpectedLeaveAttribute($__qname);
262: }
263: }
264: break;
265: case 0: {
266: revertToParentFromLeaveAttribute(this , super ._cookie,
267: $__uri, $__local, $__qname);
268: }
269: break;
270: default: {
271: unexpectedLeaveAttribute($__qname);
272: }
273: break;
274: }
275: }
276:
277: public void text(String $value) throws SAXException {
278: int $ai;
279: switch ($_ngcc_current_state) {
280: case 10: {
281: ns = $value;
282: $_ngcc_current_state = 9;
283: }
284: break;
285: case 4: {
286: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
287: $runtime.consumeAttribute($ai);
288: $runtime.sendText(super ._cookie, $value);
289: } else {
290: $_ngcc_current_state = 2;
291: $runtime.sendText(super ._cookie, $value);
292: }
293: }
294: break;
295: case 6: {
296: schemaLocation = $value;
297: $_ngcc_current_state = 5;
298: }
299: break;
300: case 2: {
301: $_ngcc_current_state = 1;
302: $runtime.sendText(super ._cookie, $value);
303: }
304: break;
305: case 8: {
306: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
307: $runtime.consumeAttribute($ai);
308: $runtime.sendText(super ._cookie, $value);
309: } else {
310: $_ngcc_current_state = 4;
311: $runtime.sendText(super ._cookie, $value);
312: }
313: }
314: break;
315: case 0: {
316: revertToParentFromText(this , super ._cookie, $value);
317: }
318: break;
319: }
320: }
321:
322: public void onChildCompleted(Object $__result__, int $__cookie__,
323: boolean $__needAttCheck__) throws SAXException {
324: switch ($__cookie__) {
325: case 3: {
326: $_ngcc_current_state = 1;
327: }
328: break;
329: }
330: }
331:
332: public boolean accepted() {
333: return (($_ngcc_current_state == 0));
334: }
335:
336: }
|