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 redefine extends NGCCHandler {
019: private String schemaLocation;
020: private ModelGroupDeclImpl newGrp;
021: private AttGroupDeclImpl newAg;
022: private SimpleTypeImpl newSt;
023: private ComplexTypeImpl newCt;
024: protected final NGCCRuntimeEx $runtime;
025: private int $_ngcc_current_state;
026: protected String $uri;
027: protected String $localName;
028: protected String $qname;
029:
030: public final NGCCRuntime getRuntime() {
031: return ($runtime);
032: }
033:
034: public redefine(NGCCHandler parent, NGCCEventSource source,
035: NGCCRuntimeEx runtime, int cookie) {
036: super (source, parent, cookie);
037: $runtime = runtime;
038: $_ngcc_current_state = 15;
039: }
040:
041: public redefine(NGCCRuntimeEx runtime) {
042: this (null, runtime, runtime, -1);
043: }
044:
045: private void action0() throws SAXException {
046: XSAttGroupDecl oldAg = $runtime.currentSchema
047: .getAttGroupDecl(newAg.getName());
048: if (oldAg == null) {
049: $runtime.reportError(Messages.format(
050: Messages.ERR_UNDEFINED_ATTRIBUTEGROUP, newAg
051: .getName()));
052: } else {
053: newAg.redefine((AttGroupDeclImpl) oldAg);
054: $runtime.currentSchema.addAttGroupDecl(newAg, true);
055: }
056: }
057:
058: private void action1() throws SAXException {
059: XSModelGroupDecl oldGrp = $runtime.currentSchema
060: .getModelGroupDecl(newGrp.getName());
061: if (oldGrp == null) {
062: $runtime.reportError(Messages
063: .format(Messages.ERR_UNDEFINED_MODELGROUP, newGrp
064: .getName()));
065: } else {
066: newGrp.redefine((ModelGroupDeclImpl) oldGrp);
067: $runtime.currentSchema.addModelGroupDecl(newGrp, true);
068: }
069: }
070:
071: private void action2() throws SAXException {
072: XSComplexType oldCt = $runtime.currentSchema
073: .getComplexType(newCt.getName());
074: if (oldCt == null) {
075: $runtime.reportError(Messages
076: .format(Messages.ERR_UNDEFINED_COMPLEXTYPE, newCt
077: .getName()));
078: } else {
079: newCt.redefine((ComplexTypeImpl) oldCt);
080: $runtime.currentSchema.addComplexType(newCt, true);
081: }
082: }
083:
084: private void action3() throws SAXException {
085: XSSimpleType oldSt = $runtime.currentSchema.getSimpleType(newSt
086: .getName());
087: if (oldSt == null) {
088: $runtime
089: .reportError(Messages.format(
090: Messages.ERR_UNDEFINED_SIMPLETYPE, newSt
091: .getName()));
092: } else {
093: newSt.redefine((SimpleTypeImpl) oldSt);
094: $runtime.currentSchema.addSimpleType(newSt, true);
095: }
096: }
097:
098: private void action4() throws SAXException {
099: $runtime.includeSchema(schemaLocation);
100: }
101:
102: public void enterElement(String $__uri, String $__local,
103: String $__qname, Attributes $attrs) throws SAXException {
104: int $ai;
105: $uri = $__uri;
106: $localName = $__local;
107: $qname = $__qname;
108: switch ($_ngcc_current_state) {
109: case 1: {
110: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
111: .equals("annotation"))) {
112: NGCCHandler h = new annotation(this , super ._source,
113: $runtime, 369, null, AnnotationContext.SCHEMA);
114: spawnChildFromEnterElement(h, $__uri, $__local,
115: $__qname, $attrs);
116: } else {
117: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
118: .equals("simpleType"))) {
119: NGCCHandler h = new simpleType(this , super ._source,
120: $runtime, 370);
121: spawnChildFromEnterElement(h, $__uri, $__local,
122: $__qname, $attrs);
123: } else {
124: if (($__uri
125: .equals("http://www.w3.org/2001/XMLSchema") && $__local
126: .equals("complexType"))) {
127: NGCCHandler h = new complexType(this ,
128: super ._source, $runtime, 371);
129: spawnChildFromEnterElement(h, $__uri, $__local,
130: $__qname, $attrs);
131: } else {
132: if (($__uri
133: .equals("http://www.w3.org/2001/XMLSchema") && $__local
134: .equals("group"))) {
135: NGCCHandler h = new group(this ,
136: super ._source, $runtime, 372);
137: spawnChildFromEnterElement(h, $__uri,
138: $__local, $__qname, $attrs);
139: } else {
140: if (($__uri
141: .equals("http://www.w3.org/2001/XMLSchema") && $__local
142: .equals("attributeGroup"))) {
143: NGCCHandler h = new attributeGroupDecl(
144: this , super ._source, $runtime,
145: 373);
146: spawnChildFromEnterElement(h, $__uri,
147: $__local, $__qname, $attrs);
148: } else {
149: unexpectedEnterElement($__qname);
150: }
151: }
152: }
153: }
154: }
155: }
156: break;
157: case 2: {
158: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
159: .equals("annotation"))) {
160: NGCCHandler h = new annotation(this , super ._source,
161: $runtime, 374, null, AnnotationContext.SCHEMA);
162: spawnChildFromEnterElement(h, $__uri, $__local,
163: $__qname, $attrs);
164: } else {
165: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
166: .equals("simpleType"))) {
167: NGCCHandler h = new simpleType(this , super ._source,
168: $runtime, 375);
169: spawnChildFromEnterElement(h, $__uri, $__local,
170: $__qname, $attrs);
171: } else {
172: if (($__uri
173: .equals("http://www.w3.org/2001/XMLSchema") && $__local
174: .equals("complexType"))) {
175: NGCCHandler h = new complexType(this ,
176: super ._source, $runtime, 376);
177: spawnChildFromEnterElement(h, $__uri, $__local,
178: $__qname, $attrs);
179: } else {
180: if (($__uri
181: .equals("http://www.w3.org/2001/XMLSchema") && $__local
182: .equals("group"))) {
183: NGCCHandler h = new group(this ,
184: super ._source, $runtime, 377);
185: spawnChildFromEnterElement(h, $__uri,
186: $__local, $__qname, $attrs);
187: } else {
188: if (($__uri
189: .equals("http://www.w3.org/2001/XMLSchema") && $__local
190: .equals("attributeGroup"))) {
191: NGCCHandler h = new attributeGroupDecl(
192: this , super ._source, $runtime,
193: 378);
194: spawnChildFromEnterElement(h, $__uri,
195: $__local, $__qname, $attrs);
196: } else {
197: $_ngcc_current_state = 1;
198: $runtime.sendEnterElement(
199: super ._cookie, $__uri,
200: $__local, $__qname, $attrs);
201: }
202: }
203: }
204: }
205: }
206: }
207: break;
208: case 15: {
209: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
210: .equals("redefine"))) {
211: $runtime.onEnterElementConsumed($__uri, $__local,
212: $__qname, $attrs);
213: $_ngcc_current_state = 14;
214: } else {
215: unexpectedEnterElement($__qname);
216: }
217: }
218: break;
219: case 14: {
220: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
221: $runtime.consumeAttribute($ai);
222: $runtime.sendEnterElement(super ._cookie, $__uri,
223: $__local, $__qname, $attrs);
224: } else {
225: unexpectedEnterElement($__qname);
226: }
227: }
228: break;
229: case 0: {
230: revertToParentFromEnterElement(this , super ._cookie, $__uri,
231: $__local, $__qname, $attrs);
232: }
233: break;
234: default: {
235: unexpectedEnterElement($__qname);
236: }
237: break;
238: }
239: }
240:
241: public void leaveElement(String $__uri, String $__local,
242: String $__qname) throws SAXException {
243: int $ai;
244: $uri = $__uri;
245: $localName = $__local;
246: $qname = $__qname;
247: switch ($_ngcc_current_state) {
248: case 1: {
249: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
250: .equals("redefine"))) {
251: $runtime.onLeaveElementConsumed($__uri, $__local,
252: $__qname);
253: $_ngcc_current_state = 0;
254: } else {
255: unexpectedLeaveElement($__qname);
256: }
257: }
258: break;
259: case 2: {
260: $_ngcc_current_state = 1;
261: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
262: $__qname);
263: }
264: break;
265: case 14: {
266: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
267: $runtime.consumeAttribute($ai);
268: $runtime.sendLeaveElement(super ._cookie, $__uri,
269: $__local, $__qname);
270: } else {
271: unexpectedLeaveElement($__qname);
272: }
273: }
274: break;
275: case 0: {
276: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
277: $__local, $__qname);
278: }
279: break;
280: default: {
281: unexpectedLeaveElement($__qname);
282: }
283: break;
284: }
285: }
286:
287: public void enterAttribute(String $__uri, String $__local,
288: String $__qname) throws SAXException {
289: int $ai;
290: $uri = $__uri;
291: $localName = $__local;
292: $qname = $__qname;
293: switch ($_ngcc_current_state) {
294: case 2: {
295: $_ngcc_current_state = 1;
296: $runtime.sendEnterAttribute(super ._cookie, $__uri,
297: $__local, $__qname);
298: }
299: break;
300: case 14: {
301: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
302: $_ngcc_current_state = 13;
303: } else {
304: unexpectedEnterAttribute($__qname);
305: }
306: }
307: break;
308: case 0: {
309: revertToParentFromEnterAttribute(this , super ._cookie,
310: $__uri, $__local, $__qname);
311: }
312: break;
313: default: {
314: unexpectedEnterAttribute($__qname);
315: }
316: break;
317: }
318: }
319:
320: public void leaveAttribute(String $__uri, String $__local,
321: String $__qname) throws SAXException {
322: int $ai;
323: $uri = $__uri;
324: $localName = $__local;
325: $qname = $__qname;
326: switch ($_ngcc_current_state) {
327: case 2: {
328: $_ngcc_current_state = 1;
329: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
330: $__local, $__qname);
331: }
332: break;
333: case 12: {
334: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
335: $_ngcc_current_state = 2;
336: } else {
337: unexpectedLeaveAttribute($__qname);
338: }
339: }
340: break;
341: case 0: {
342: revertToParentFromLeaveAttribute(this , super ._cookie,
343: $__uri, $__local, $__qname);
344: }
345: break;
346: default: {
347: unexpectedLeaveAttribute($__qname);
348: }
349: break;
350: }
351: }
352:
353: public void text(String $value) throws SAXException {
354: int $ai;
355: switch ($_ngcc_current_state) {
356: case 2: {
357: $_ngcc_current_state = 1;
358: $runtime.sendText(super ._cookie, $value);
359: }
360: break;
361: case 14: {
362: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
363: $runtime.consumeAttribute($ai);
364: $runtime.sendText(super ._cookie, $value);
365: }
366: }
367: break;
368: case 13: {
369: schemaLocation = $value;
370: $_ngcc_current_state = 12;
371: action4();
372: }
373: break;
374: case 0: {
375: revertToParentFromText(this , super ._cookie, $value);
376: }
377: break;
378: }
379: }
380:
381: public void onChildCompleted(Object $__result__, int $__cookie__,
382: boolean $__needAttCheck__) throws SAXException {
383: switch ($__cookie__) {
384: case 374: {
385: $_ngcc_current_state = 1;
386: }
387: break;
388: case 375: {
389: newSt = ((SimpleTypeImpl) $__result__);
390: action3();
391: $_ngcc_current_state = 1;
392: }
393: break;
394: case 376: {
395: newCt = ((ComplexTypeImpl) $__result__);
396: action2();
397: $_ngcc_current_state = 1;
398: }
399: break;
400: case 377: {
401: newGrp = ((ModelGroupDeclImpl) $__result__);
402: action1();
403: $_ngcc_current_state = 1;
404: }
405: break;
406: case 378: {
407: newAg = ((AttGroupDeclImpl) $__result__);
408: action0();
409: $_ngcc_current_state = 1;
410: }
411: break;
412: case 369: {
413: $_ngcc_current_state = 1;
414: }
415: break;
416: case 370: {
417: newSt = ((SimpleTypeImpl) $__result__);
418: action3();
419: $_ngcc_current_state = 1;
420: }
421: break;
422: case 371: {
423: newCt = ((ComplexTypeImpl) $__result__);
424: action2();
425: $_ngcc_current_state = 1;
426: }
427: break;
428: case 372: {
429: newGrp = ((ModelGroupDeclImpl) $__result__);
430: action1();
431: $_ngcc_current_state = 1;
432: }
433: break;
434: case 373: {
435: newAg = ((AttGroupDeclImpl) $__result__);
436: action0();
437: $_ngcc_current_state = 1;
438: }
439: break;
440: }
441: }
442:
443: public boolean accepted() {
444: return (($_ngcc_current_state == 0));
445: }
446:
447: }
|