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 SimpleType_Restriction extends NGCCHandler {
019: private Locator locator;
020: private AnnotationImpl annotation;
021: private String name;
022: private UName baseTypeName;
023: private Set finalSet;
024: private ForeignAttributesImpl fa;
025: private XSFacet facet;
026: protected final NGCCRuntimeEx $runtime;
027: private int $_ngcc_current_state;
028: protected String $uri;
029: protected String $localName;
030: protected String $qname;
031:
032: public final NGCCRuntime getRuntime() {
033: return ($runtime);
034: }
035:
036: public SimpleType_Restriction(NGCCHandler parent,
037: NGCCEventSource source, NGCCRuntimeEx runtime, int cookie,
038: AnnotationImpl _annotation, Locator _locator,
039: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
040: super (source, parent, cookie);
041: $runtime = runtime;
042: this .annotation = _annotation;
043: this .locator = _locator;
044: this .fa = _fa;
045: this .name = _name;
046: this .finalSet = _finalSet;
047: $_ngcc_current_state = 13;
048: }
049:
050: public SimpleType_Restriction(NGCCRuntimeEx runtime,
051: AnnotationImpl _annotation, Locator _locator,
052: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
053: this (null, runtime, runtime, -1, _annotation, _locator, _fa,
054: _name, _finalSet);
055: }
056:
057: private void action0() throws SAXException {
058:
059: result.addFacet(facet);
060:
061: }
062:
063: private void action1() throws SAXException {
064:
065: result = new RestrictionSimpleTypeImpl($runtime.document,
066: annotation, locator, fa, name, name == null, finalSet,
067: baseType);
068:
069: }
070:
071: private void action2() throws SAXException {
072:
073: baseType = new DelayedRef.SimpleType($runtime, rloc,
074: $runtime.currentSchema, baseTypeName);
075:
076: }
077:
078: private void action3() throws SAXException {
079: rloc = $runtime.copyLocator();
080: }
081:
082: public void enterElement(String $__uri, String $__local,
083: String $__qname, Attributes $attrs) throws SAXException {
084: int $ai;
085: $uri = $__uri;
086: $localName = $__local;
087: $qname = $__qname;
088: switch ($_ngcc_current_state) {
089: case 1: {
090: if ((((((((((((($__uri
091: .equals("http://www.w3.org/2001/XMLSchema") && $__local
092: .equals("minExclusive")) || ($__uri
093: .equals("http://www.w3.org/2001/XMLSchema") && $__local
094: .equals("maxExclusive"))) || ($__uri
095: .equals("http://www.w3.org/2001/XMLSchema") && $__local
096: .equals("minInclusive"))) || ($__uri
097: .equals("http://www.w3.org/2001/XMLSchema") && $__local
098: .equals("maxInclusive"))) || ($__uri
099: .equals("http://www.w3.org/2001/XMLSchema") && $__local
100: .equals("totalDigits"))) || ($__uri
101: .equals("http://www.w3.org/2001/XMLSchema") && $__local
102: .equals("fractionDigits"))) || ($__uri
103: .equals("http://www.w3.org/2001/XMLSchema") && $__local
104: .equals("length"))) || ($__uri
105: .equals("http://www.w3.org/2001/XMLSchema") && $__local
106: .equals("maxLength"))) || ($__uri
107: .equals("http://www.w3.org/2001/XMLSchema") && $__local
108: .equals("minLength"))) || ($__uri
109: .equals("http://www.w3.org/2001/XMLSchema") && $__local
110: .equals("enumeration"))) || ($__uri
111: .equals("http://www.w3.org/2001/XMLSchema") && $__local
112: .equals("whiteSpace"))) || ($__uri
113: .equals("http://www.w3.org/2001/XMLSchema") && $__local
114: .equals("pattern")))) {
115: NGCCHandler h = new facet(this , super ._source,
116: $runtime, 529);
117: spawnChildFromEnterElement(h, $__uri, $__local,
118: $__qname, $attrs);
119: } else {
120: unexpectedEnterElement($__qname);
121: }
122: }
123: break;
124: case 13: {
125: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
126: .equals("restriction"))) {
127: $runtime.onEnterElementConsumed($__uri, $__local,
128: $__qname, $attrs);
129: action3();
130: $_ngcc_current_state = 12;
131: } else {
132: unexpectedEnterElement($__qname);
133: }
134: }
135: break;
136: case 10: {
137: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
138: .equals("annotation"))) {
139: NGCCHandler h = new annotation(this , super ._source,
140: $runtime, 540, annotation,
141: AnnotationContext.SIMPLETYPE_DECL);
142: spawnChildFromEnterElement(h, $__uri, $__local,
143: $__qname, $attrs);
144: } else {
145: $_ngcc_current_state = 5;
146: $runtime.sendEnterElement(super ._cookie, $__uri,
147: $__local, $__qname, $attrs);
148: }
149: }
150: break;
151: case 5: {
152: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
153: $runtime.consumeAttribute($ai);
154: $runtime.sendEnterElement(super ._cookie, $__uri,
155: $__local, $__qname, $attrs);
156: } else {
157: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
158: .equals("simpleType"))) {
159: NGCCHandler h = new simpleType(this , super ._source,
160: $runtime, 534);
161: spawnChildFromEnterElement(h, $__uri, $__local,
162: $__qname, $attrs);
163: } else {
164: unexpectedEnterElement($__qname);
165: }
166: }
167: }
168: break;
169: case 12: {
170: if ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
171: .equals("annotation")) || ((($ai = $runtime
172: .getAttributeIndex("", "base")) >= 0 && (((((((((((((($__uri
173: .equals("http://www.w3.org/2001/XMLSchema") && $__local
174: .equals("minExclusive")) || ($__uri
175: .equals("http://www.w3.org/2001/XMLSchema") && $__local
176: .equals("maxExclusive"))) || ($__uri
177: .equals("http://www.w3.org/2001/XMLSchema") && $__local
178: .equals("minInclusive"))) || ($__uri
179: .equals("http://www.w3.org/2001/XMLSchema") && $__local
180: .equals("maxInclusive"))) || ($__uri
181: .equals("http://www.w3.org/2001/XMLSchema") && $__local
182: .equals("totalDigits"))) || ($__uri
183: .equals("http://www.w3.org/2001/XMLSchema") && $__local
184: .equals("fractionDigits"))) || ($__uri
185: .equals("http://www.w3.org/2001/XMLSchema") && $__local
186: .equals("length"))) || ($__uri
187: .equals("http://www.w3.org/2001/XMLSchema") && $__local
188: .equals("maxLength"))) || ($__uri
189: .equals("http://www.w3.org/2001/XMLSchema") && $__local
190: .equals("minLength"))) || ($__uri
191: .equals("http://www.w3.org/2001/XMLSchema") && $__local
192: .equals("enumeration"))) || ($__uri
193: .equals("http://www.w3.org/2001/XMLSchema") && $__local
194: .equals("whiteSpace"))) || ($__uri
195: .equals("http://www.w3.org/2001/XMLSchema") && $__local
196: .equals("pattern"))) || ($__uri
197: .equals("http://www.w3.org/2001/XMLSchema") && $__local
198: .equals("simpleType"))) || ($__uri
199: .equals("http://www.w3.org/2001/XMLSchema") && $__local
200: .equals("annotation")))) || ($__uri
201: .equals("http://www.w3.org/2001/XMLSchema") && $__local
202: .equals("simpleType"))))) {
203: NGCCHandler h = new foreignAttributes(this ,
204: super ._source, $runtime, 542, fa);
205: spawnChildFromEnterElement(h, $__uri, $__local,
206: $__qname, $attrs);
207: } else {
208: unexpectedEnterElement($__qname);
209: }
210: }
211: break;
212: case 4: {
213: action1();
214: $_ngcc_current_state = 2;
215: $runtime.sendEnterElement(super ._cookie, $__uri, $__local,
216: $__qname, $attrs);
217: }
218: break;
219: case 2: {
220: if ((((((((((((($__uri
221: .equals("http://www.w3.org/2001/XMLSchema") && $__local
222: .equals("minExclusive")) || ($__uri
223: .equals("http://www.w3.org/2001/XMLSchema") && $__local
224: .equals("maxExclusive"))) || ($__uri
225: .equals("http://www.w3.org/2001/XMLSchema") && $__local
226: .equals("minInclusive"))) || ($__uri
227: .equals("http://www.w3.org/2001/XMLSchema") && $__local
228: .equals("maxInclusive"))) || ($__uri
229: .equals("http://www.w3.org/2001/XMLSchema") && $__local
230: .equals("totalDigits"))) || ($__uri
231: .equals("http://www.w3.org/2001/XMLSchema") && $__local
232: .equals("fractionDigits"))) || ($__uri
233: .equals("http://www.w3.org/2001/XMLSchema") && $__local
234: .equals("length"))) || ($__uri
235: .equals("http://www.w3.org/2001/XMLSchema") && $__local
236: .equals("maxLength"))) || ($__uri
237: .equals("http://www.w3.org/2001/XMLSchema") && $__local
238: .equals("minLength"))) || ($__uri
239: .equals("http://www.w3.org/2001/XMLSchema") && $__local
240: .equals("enumeration"))) || ($__uri
241: .equals("http://www.w3.org/2001/XMLSchema") && $__local
242: .equals("whiteSpace"))) || ($__uri
243: .equals("http://www.w3.org/2001/XMLSchema") && $__local
244: .equals("pattern")))) {
245: NGCCHandler h = new facet(this , super ._source,
246: $runtime, 530);
247: spawnChildFromEnterElement(h, $__uri, $__local,
248: $__qname, $attrs);
249: } else {
250: $_ngcc_current_state = 1;
251: $runtime.sendEnterElement(super ._cookie, $__uri,
252: $__local, $__qname, $attrs);
253: }
254: }
255: break;
256: case 0: {
257: revertToParentFromEnterElement(result, super ._cookie,
258: $__uri, $__local, $__qname, $attrs);
259: }
260: break;
261: default: {
262: unexpectedEnterElement($__qname);
263: }
264: break;
265: }
266: }
267:
268: public void leaveElement(String $__uri, String $__local,
269: String $__qname) throws SAXException {
270: int $ai;
271: $uri = $__uri;
272: $localName = $__local;
273: $qname = $__qname;
274: switch ($_ngcc_current_state) {
275: case 1: {
276: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
277: .equals("restriction"))) {
278: $runtime.onLeaveElementConsumed($__uri, $__local,
279: $__qname);
280: $_ngcc_current_state = 0;
281: } else {
282: unexpectedLeaveElement($__qname);
283: }
284: }
285: break;
286: case 10: {
287: $_ngcc_current_state = 5;
288: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
289: $__qname);
290: }
291: break;
292: case 5: {
293: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
294: $runtime.consumeAttribute($ai);
295: $runtime.sendLeaveElement(super ._cookie, $__uri,
296: $__local, $__qname);
297: } else {
298: unexpectedLeaveElement($__qname);
299: }
300: }
301: break;
302: case 12: {
303: if ((($ai = $runtime.getAttributeIndex("", "base")) >= 0 && ($__uri
304: .equals("http://www.w3.org/2001/XMLSchema") && $__local
305: .equals("restriction")))) {
306: NGCCHandler h = new foreignAttributes(this ,
307: super ._source, $runtime, 542, fa);
308: spawnChildFromLeaveElement(h, $__uri, $__local,
309: $__qname);
310: } else {
311: unexpectedLeaveElement($__qname);
312: }
313: }
314: break;
315: case 4: {
316: action1();
317: $_ngcc_current_state = 2;
318: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
319: $__qname);
320: }
321: break;
322: case 2: {
323: $_ngcc_current_state = 1;
324: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
325: $__qname);
326: }
327: break;
328: case 0: {
329: revertToParentFromLeaveElement(result, super ._cookie,
330: $__uri, $__local, $__qname);
331: }
332: break;
333: default: {
334: unexpectedLeaveElement($__qname);
335: }
336: break;
337: }
338: }
339:
340: public void enterAttribute(String $__uri, String $__local,
341: String $__qname) throws SAXException {
342: int $ai;
343: $uri = $__uri;
344: $localName = $__local;
345: $qname = $__qname;
346: switch ($_ngcc_current_state) {
347: case 10: {
348: $_ngcc_current_state = 5;
349: $runtime.sendEnterAttribute(super ._cookie, $__uri,
350: $__local, $__qname);
351: }
352: break;
353: case 5: {
354: if (($__uri.equals("") && $__local.equals("base"))) {
355: $_ngcc_current_state = 8;
356: } else {
357: unexpectedEnterAttribute($__qname);
358: }
359: }
360: break;
361: case 12: {
362: if (($__uri.equals("") && $__local.equals("base"))) {
363: NGCCHandler h = new foreignAttributes(this ,
364: super ._source, $runtime, 542, fa);
365: spawnChildFromEnterAttribute(h, $__uri, $__local,
366: $__qname);
367: } else {
368: unexpectedEnterAttribute($__qname);
369: }
370: }
371: break;
372: case 4: {
373: action1();
374: $_ngcc_current_state = 2;
375: $runtime.sendEnterAttribute(super ._cookie, $__uri,
376: $__local, $__qname);
377: }
378: break;
379: case 2: {
380: $_ngcc_current_state = 1;
381: $runtime.sendEnterAttribute(super ._cookie, $__uri,
382: $__local, $__qname);
383: }
384: break;
385: case 0: {
386: revertToParentFromEnterAttribute(result, super ._cookie,
387: $__uri, $__local, $__qname);
388: }
389: break;
390: default: {
391: unexpectedEnterAttribute($__qname);
392: }
393: break;
394: }
395: }
396:
397: public void leaveAttribute(String $__uri, String $__local,
398: String $__qname) throws SAXException {
399: int $ai;
400: $uri = $__uri;
401: $localName = $__local;
402: $qname = $__qname;
403: switch ($_ngcc_current_state) {
404: case 7: {
405: if (($__uri.equals("") && $__local.equals("base"))) {
406: $_ngcc_current_state = 4;
407: } else {
408: unexpectedLeaveAttribute($__qname);
409: }
410: }
411: break;
412: case 10: {
413: $_ngcc_current_state = 5;
414: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
415: $__local, $__qname);
416: }
417: break;
418: case 4: {
419: action1();
420: $_ngcc_current_state = 2;
421: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
422: $__local, $__qname);
423: }
424: break;
425: case 2: {
426: $_ngcc_current_state = 1;
427: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
428: $__local, $__qname);
429: }
430: break;
431: case 0: {
432: revertToParentFromLeaveAttribute(result, super ._cookie,
433: $__uri, $__local, $__qname);
434: }
435: break;
436: default: {
437: unexpectedLeaveAttribute($__qname);
438: }
439: break;
440: }
441: }
442:
443: public void text(String $value) throws SAXException {
444: int $ai;
445: switch ($_ngcc_current_state) {
446: case 8: {
447: NGCCHandler h = new qname(this , super ._source, $runtime,
448: 536);
449: spawnChildFromText(h, $value);
450: }
451: break;
452: case 10: {
453: $_ngcc_current_state = 5;
454: $runtime.sendText(super ._cookie, $value);
455: }
456: break;
457: case 5: {
458: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
459: $runtime.consumeAttribute($ai);
460: $runtime.sendText(super ._cookie, $value);
461: }
462: }
463: break;
464: case 12: {
465: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
466: NGCCHandler h = new foreignAttributes(this ,
467: super ._source, $runtime, 542, fa);
468: spawnChildFromText(h, $value);
469: }
470: }
471: break;
472: case 4: {
473: action1();
474: $_ngcc_current_state = 2;
475: $runtime.sendText(super ._cookie, $value);
476: }
477: break;
478: case 2: {
479: $_ngcc_current_state = 1;
480: $runtime.sendText(super ._cookie, $value);
481: }
482: break;
483: case 0: {
484: revertToParentFromText(result, super ._cookie, $value);
485: }
486: break;
487: }
488: }
489:
490: public void onChildCompleted(Object $__result__, int $__cookie__,
491: boolean $__needAttCheck__) throws SAXException {
492: switch ($__cookie__) {
493: case 529: {
494: facet = ((XSFacet) $__result__);
495: action0();
496: $_ngcc_current_state = 1;
497: }
498: break;
499: case 530: {
500: facet = ((XSFacet) $__result__);
501: action0();
502: $_ngcc_current_state = 1;
503: }
504: break;
505: case 536: {
506: baseTypeName = ((UName) $__result__);
507: action2();
508: $_ngcc_current_state = 7;
509: }
510: break;
511: case 540: {
512: annotation = ((AnnotationImpl) $__result__);
513: $_ngcc_current_state = 5;
514: }
515: break;
516: case 534: {
517: baseType = ((SimpleTypeImpl) $__result__);
518: $_ngcc_current_state = 4;
519: }
520: break;
521: case 542: {
522: fa = ((ForeignAttributesImpl) $__result__);
523: $_ngcc_current_state = 10;
524: }
525: break;
526: }
527: }
528:
529: public boolean accepted() {
530: return (($_ngcc_current_state == 0));
531: }
532:
533: /** computed simple type object */
534: private RestrictionSimpleTypeImpl result;
535:
536: // reference to the base type
537: private Ref.SimpleType baseType;
538:
539: // location of restriction
540: private Locator rloc;
541:
542: }
|