001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: /* this file is generated by RelaxNGCC */
027: package com.sun.xml.internal.xsom.impl.parser.state;
028:
029: import org.xml.sax.SAXException;
030: import org.xml.sax.XMLReader;
031: import org.xml.sax.Attributes;
032: import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
033:
034: import com.sun.xml.internal.xsom.*;
035: import com.sun.xml.internal.xsom.parser.*;
036: import com.sun.xml.internal.xsom.impl.*;
037: import com.sun.xml.internal.xsom.impl.parser.*;
038: import org.xml.sax.Locator;
039: import org.xml.sax.ContentHandler;
040: import org.xml.sax.helpers.*;
041: import java.util.*;
042:
043: class SimpleType_Restriction extends NGCCHandler {
044: private Locator locator;
045: private AnnotationImpl annotation;
046: private String name;
047: private UName baseTypeName;
048: private Set finalSet;
049: private ForeignAttributesImpl fa;
050: private XSFacet facet;
051: protected final NGCCRuntimeEx $runtime;
052: private int $_ngcc_current_state;
053: protected String $uri;
054: protected String $localName;
055: protected String $qname;
056:
057: public final NGCCRuntime getRuntime() {
058: return ($runtime);
059: }
060:
061: public SimpleType_Restriction(NGCCHandler parent,
062: NGCCEventSource source, NGCCRuntimeEx runtime, int cookie,
063: AnnotationImpl _annotation, Locator _locator,
064: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
065: super (source, parent, cookie);
066: $runtime = runtime;
067: this .annotation = _annotation;
068: this .locator = _locator;
069: this .fa = _fa;
070: this .name = _name;
071: this .finalSet = _finalSet;
072: $_ngcc_current_state = 13;
073: }
074:
075: public SimpleType_Restriction(NGCCRuntimeEx runtime,
076: AnnotationImpl _annotation, Locator _locator,
077: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
078: this (null, runtime, runtime, -1, _annotation, _locator, _fa,
079: _name, _finalSet);
080: }
081:
082: private void action0() throws SAXException {
083:
084: result.addFacet(facet);
085:
086: }
087:
088: private void action1() throws SAXException {
089:
090: result = new RestrictionSimpleTypeImpl($runtime.document,
091: annotation, locator, fa, name, name == null, finalSet,
092: baseType);
093:
094: }
095:
096: private void action2() throws SAXException {
097:
098: baseType = new DelayedRef.SimpleType($runtime, rloc,
099: $runtime.currentSchema, baseTypeName);
100:
101: }
102:
103: private void action3() throws SAXException {
104: rloc = $runtime.copyLocator();
105: }
106:
107: public void enterElement(String $__uri, String $__local,
108: String $__qname, Attributes $attrs) throws SAXException {
109: int $ai;
110: $uri = $__uri;
111: $localName = $__local;
112: $qname = $__qname;
113: switch ($_ngcc_current_state) {
114: case 10: {
115: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
116: .equals("annotation"))) {
117: NGCCHandler h = new annotation(this , super ._source,
118: $runtime, 604, annotation,
119: AnnotationContext.SIMPLETYPE_DECL);
120: spawnChildFromEnterElement(h, $__uri, $__local,
121: $__qname, $attrs);
122: } else {
123: $_ngcc_current_state = 5;
124: $runtime.sendEnterElement(super ._cookie, $__uri,
125: $__local, $__qname, $attrs);
126: }
127: }
128: break;
129: case 0: {
130: revertToParentFromEnterElement(result, super ._cookie,
131: $__uri, $__local, $__qname, $attrs);
132: }
133: break;
134: case 13: {
135: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
136: .equals("restriction"))) {
137: $runtime.onEnterElementConsumed($__uri, $__local,
138: $__qname, $attrs);
139: action3();
140: $_ngcc_current_state = 12;
141: } else {
142: unexpectedEnterElement($__qname);
143: }
144: }
145: break;
146: case 4: {
147: action1();
148: $_ngcc_current_state = 2;
149: $runtime.sendEnterElement(super ._cookie, $__uri, $__local,
150: $__qname, $attrs);
151: }
152: break;
153: case 1: {
154: if ((((((((((((($__uri
155: .equals("http://www.w3.org/2001/XMLSchema") && $__local
156: .equals("minExclusive")) || ($__uri
157: .equals("http://www.w3.org/2001/XMLSchema") && $__local
158: .equals("maxExclusive"))) || ($__uri
159: .equals("http://www.w3.org/2001/XMLSchema") && $__local
160: .equals("minInclusive"))) || ($__uri
161: .equals("http://www.w3.org/2001/XMLSchema") && $__local
162: .equals("maxInclusive"))) || ($__uri
163: .equals("http://www.w3.org/2001/XMLSchema") && $__local
164: .equals("totalDigits"))) || ($__uri
165: .equals("http://www.w3.org/2001/XMLSchema") && $__local
166: .equals("fractionDigits"))) || ($__uri
167: .equals("http://www.w3.org/2001/XMLSchema") && $__local
168: .equals("length"))) || ($__uri
169: .equals("http://www.w3.org/2001/XMLSchema") && $__local
170: .equals("maxLength"))) || ($__uri
171: .equals("http://www.w3.org/2001/XMLSchema") && $__local
172: .equals("minLength"))) || ($__uri
173: .equals("http://www.w3.org/2001/XMLSchema") && $__local
174: .equals("enumeration"))) || ($__uri
175: .equals("http://www.w3.org/2001/XMLSchema") && $__local
176: .equals("whiteSpace"))) || ($__uri
177: .equals("http://www.w3.org/2001/XMLSchema") && $__local
178: .equals("pattern")))) {
179: NGCCHandler h = new facet(this , super ._source,
180: $runtime, 593);
181: spawnChildFromEnterElement(h, $__uri, $__local,
182: $__qname, $attrs);
183: } else {
184: unexpectedEnterElement($__qname);
185: }
186: }
187: break;
188: case 2: {
189: if ((((((((((((($__uri
190: .equals("http://www.w3.org/2001/XMLSchema") && $__local
191: .equals("minExclusive")) || ($__uri
192: .equals("http://www.w3.org/2001/XMLSchema") && $__local
193: .equals("maxExclusive"))) || ($__uri
194: .equals("http://www.w3.org/2001/XMLSchema") && $__local
195: .equals("minInclusive"))) || ($__uri
196: .equals("http://www.w3.org/2001/XMLSchema") && $__local
197: .equals("maxInclusive"))) || ($__uri
198: .equals("http://www.w3.org/2001/XMLSchema") && $__local
199: .equals("totalDigits"))) || ($__uri
200: .equals("http://www.w3.org/2001/XMLSchema") && $__local
201: .equals("fractionDigits"))) || ($__uri
202: .equals("http://www.w3.org/2001/XMLSchema") && $__local
203: .equals("length"))) || ($__uri
204: .equals("http://www.w3.org/2001/XMLSchema") && $__local
205: .equals("maxLength"))) || ($__uri
206: .equals("http://www.w3.org/2001/XMLSchema") && $__local
207: .equals("minLength"))) || ($__uri
208: .equals("http://www.w3.org/2001/XMLSchema") && $__local
209: .equals("enumeration"))) || ($__uri
210: .equals("http://www.w3.org/2001/XMLSchema") && $__local
211: .equals("whiteSpace"))) || ($__uri
212: .equals("http://www.w3.org/2001/XMLSchema") && $__local
213: .equals("pattern")))) {
214: NGCCHandler h = new facet(this , super ._source,
215: $runtime, 594);
216: spawnChildFromEnterElement(h, $__uri, $__local,
217: $__qname, $attrs);
218: } else {
219: $_ngcc_current_state = 1;
220: $runtime.sendEnterElement(super ._cookie, $__uri,
221: $__local, $__qname, $attrs);
222: }
223: }
224: break;
225: case 12: {
226: if ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
227: .equals("annotation")) || (($__uri
228: .equals("http://www.w3.org/2001/XMLSchema") && $__local
229: .equals("simpleType")) || (($ai = $runtime
230: .getAttributeIndex("", "base")) >= 0 && ((($__uri
231: .equals("http://www.w3.org/2001/XMLSchema") && $__local
232: .equals("simpleType")) || (((((((((((($__uri
233: .equals("http://www.w3.org/2001/XMLSchema") && $__local
234: .equals("minExclusive")) || ($__uri
235: .equals("http://www.w3.org/2001/XMLSchema") && $__local
236: .equals("maxExclusive"))) || ($__uri
237: .equals("http://www.w3.org/2001/XMLSchema") && $__local
238: .equals("minInclusive"))) || ($__uri
239: .equals("http://www.w3.org/2001/XMLSchema") && $__local
240: .equals("maxInclusive"))) || ($__uri
241: .equals("http://www.w3.org/2001/XMLSchema") && $__local
242: .equals("totalDigits"))) || ($__uri
243: .equals("http://www.w3.org/2001/XMLSchema") && $__local
244: .equals("fractionDigits"))) || ($__uri
245: .equals("http://www.w3.org/2001/XMLSchema") && $__local
246: .equals("length"))) || ($__uri
247: .equals("http://www.w3.org/2001/XMLSchema") && $__local
248: .equals("maxLength"))) || ($__uri
249: .equals("http://www.w3.org/2001/XMLSchema") && $__local
250: .equals("minLength"))) || ($__uri
251: .equals("http://www.w3.org/2001/XMLSchema") && $__local
252: .equals("enumeration"))) || ($__uri
253: .equals("http://www.w3.org/2001/XMLSchema") && $__local
254: .equals("whiteSpace"))) || ($__uri
255: .equals("http://www.w3.org/2001/XMLSchema") && $__local
256: .equals("pattern")))) || ($__uri
257: .equals("http://www.w3.org/2001/XMLSchema") && $__local
258: .equals("annotation"))))))) {
259: NGCCHandler h = new foreignAttributes(this ,
260: super ._source, $runtime, 606, fa);
261: spawnChildFromEnterElement(h, $__uri, $__local,
262: $__qname, $attrs);
263: } else {
264: unexpectedEnterElement($__qname);
265: }
266: }
267: break;
268: case 5: {
269: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
270: $runtime.consumeAttribute($ai);
271: $runtime.sendEnterElement(super ._cookie, $__uri,
272: $__local, $__qname, $attrs);
273: } else {
274: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
275: .equals("simpleType"))) {
276: NGCCHandler h = new simpleType(this , super ._source,
277: $runtime, 598);
278: spawnChildFromEnterElement(h, $__uri, $__local,
279: $__qname, $attrs);
280: } else {
281: unexpectedEnterElement($__qname);
282: }
283: }
284: }
285: break;
286: default: {
287: unexpectedEnterElement($__qname);
288: }
289: break;
290: }
291: }
292:
293: public void leaveElement(String $__uri, String $__local,
294: String $__qname) throws SAXException {
295: int $ai;
296: $uri = $__uri;
297: $localName = $__local;
298: $qname = $__qname;
299: switch ($_ngcc_current_state) {
300: case 10: {
301: $_ngcc_current_state = 5;
302: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
303: $__qname);
304: }
305: break;
306: case 0: {
307: revertToParentFromLeaveElement(result, super ._cookie,
308: $__uri, $__local, $__qname);
309: }
310: break;
311: case 4: {
312: action1();
313: $_ngcc_current_state = 2;
314: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
315: $__qname);
316: }
317: break;
318: case 1: {
319: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
320: .equals("restriction"))) {
321: $runtime.onLeaveElementConsumed($__uri, $__local,
322: $__qname);
323: $_ngcc_current_state = 0;
324: } else {
325: unexpectedLeaveElement($__qname);
326: }
327: }
328: break;
329: case 2: {
330: $_ngcc_current_state = 1;
331: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
332: $__qname);
333: }
334: break;
335: case 12: {
336: if ((($ai = $runtime.getAttributeIndex("", "base")) >= 0 && ($__uri
337: .equals("http://www.w3.org/2001/XMLSchema") && $__local
338: .equals("restriction")))) {
339: NGCCHandler h = new foreignAttributes(this ,
340: super ._source, $runtime, 606, fa);
341: spawnChildFromLeaveElement(h, $__uri, $__local,
342: $__qname);
343: } else {
344: unexpectedLeaveElement($__qname);
345: }
346: }
347: break;
348: case 5: {
349: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
350: $runtime.consumeAttribute($ai);
351: $runtime.sendLeaveElement(super ._cookie, $__uri,
352: $__local, $__qname);
353: } else {
354: unexpectedLeaveElement($__qname);
355: }
356: }
357: break;
358: default: {
359: unexpectedLeaveElement($__qname);
360: }
361: break;
362: }
363: }
364:
365: public void enterAttribute(String $__uri, String $__local,
366: String $__qname) throws SAXException {
367: int $ai;
368: $uri = $__uri;
369: $localName = $__local;
370: $qname = $__qname;
371: switch ($_ngcc_current_state) {
372: case 10: {
373: $_ngcc_current_state = 5;
374: $runtime.sendEnterAttribute(super ._cookie, $__uri,
375: $__local, $__qname);
376: }
377: break;
378: case 0: {
379: revertToParentFromEnterAttribute(result, super ._cookie,
380: $__uri, $__local, $__qname);
381: }
382: break;
383: case 4: {
384: action1();
385: $_ngcc_current_state = 2;
386: $runtime.sendEnterAttribute(super ._cookie, $__uri,
387: $__local, $__qname);
388: }
389: break;
390: case 2: {
391: $_ngcc_current_state = 1;
392: $runtime.sendEnterAttribute(super ._cookie, $__uri,
393: $__local, $__qname);
394: }
395: break;
396: case 12: {
397: if (($__uri.equals("") && $__local.equals("base"))) {
398: NGCCHandler h = new foreignAttributes(this ,
399: super ._source, $runtime, 606, fa);
400: spawnChildFromEnterAttribute(h, $__uri, $__local,
401: $__qname);
402: } else {
403: unexpectedEnterAttribute($__qname);
404: }
405: }
406: break;
407: case 5: {
408: if (($__uri.equals("") && $__local.equals("base"))) {
409: $_ngcc_current_state = 8;
410: } else {
411: unexpectedEnterAttribute($__qname);
412: }
413: }
414: break;
415: default: {
416: unexpectedEnterAttribute($__qname);
417: }
418: break;
419: }
420: }
421:
422: public void leaveAttribute(String $__uri, String $__local,
423: String $__qname) throws SAXException {
424: int $ai;
425: $uri = $__uri;
426: $localName = $__local;
427: $qname = $__qname;
428: switch ($_ngcc_current_state) {
429: case 10: {
430: $_ngcc_current_state = 5;
431: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
432: $__local, $__qname);
433: }
434: break;
435: case 0: {
436: revertToParentFromLeaveAttribute(result, super ._cookie,
437: $__uri, $__local, $__qname);
438: }
439: break;
440: case 4: {
441: action1();
442: $_ngcc_current_state = 2;
443: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
444: $__local, $__qname);
445: }
446: break;
447: case 2: {
448: $_ngcc_current_state = 1;
449: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
450: $__local, $__qname);
451: }
452: break;
453: case 7: {
454: if (($__uri.equals("") && $__local.equals("base"))) {
455: $_ngcc_current_state = 4;
456: } else {
457: unexpectedLeaveAttribute($__qname);
458: }
459: }
460: break;
461: default: {
462: unexpectedLeaveAttribute($__qname);
463: }
464: break;
465: }
466: }
467:
468: public void text(String $value) throws SAXException {
469: int $ai;
470: switch ($_ngcc_current_state) {
471: case 10: {
472: $_ngcc_current_state = 5;
473: $runtime.sendText(super ._cookie, $value);
474: }
475: break;
476: case 0: {
477: revertToParentFromText(result, super ._cookie, $value);
478: }
479: break;
480: case 4: {
481: action1();
482: $_ngcc_current_state = 2;
483: $runtime.sendText(super ._cookie, $value);
484: }
485: break;
486: case 2: {
487: $_ngcc_current_state = 1;
488: $runtime.sendText(super ._cookie, $value);
489: }
490: break;
491: case 8: {
492: NGCCHandler h = new qname(this , super ._source, $runtime,
493: 600);
494: spawnChildFromText(h, $value);
495: }
496: break;
497: case 12: {
498: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
499: NGCCHandler h = new foreignAttributes(this ,
500: super ._source, $runtime, 606, fa);
501: spawnChildFromText(h, $value);
502: }
503: }
504: break;
505: case 5: {
506: if (($ai = $runtime.getAttributeIndex("", "base")) >= 0) {
507: $runtime.consumeAttribute($ai);
508: $runtime.sendText(super ._cookie, $value);
509: }
510: }
511: break;
512: }
513: }
514:
515: public void onChildCompleted(Object $__result__, int $__cookie__,
516: boolean $__needAttCheck__) throws SAXException {
517: switch ($__cookie__) {
518: case 604: {
519: annotation = ((AnnotationImpl) $__result__);
520: $_ngcc_current_state = 5;
521: }
522: break;
523: case 593: {
524: facet = ((XSFacet) $__result__);
525: action0();
526: $_ngcc_current_state = 1;
527: }
528: break;
529: case 606: {
530: fa = ((ForeignAttributesImpl) $__result__);
531: $_ngcc_current_state = 10;
532: }
533: break;
534: case 598: {
535: baseType = ((SimpleTypeImpl) $__result__);
536: $_ngcc_current_state = 4;
537: }
538: break;
539: case 594: {
540: facet = ((XSFacet) $__result__);
541: action0();
542: $_ngcc_current_state = 1;
543: }
544: break;
545: case 600: {
546: baseTypeName = ((UName) $__result__);
547: action2();
548: $_ngcc_current_state = 7;
549: }
550: break;
551: }
552: }
553:
554: public boolean accepted() {
555: return (($_ngcc_current_state == 0));
556: }
557:
558: /** computed simple type object */
559: private RestrictionSimpleTypeImpl result;
560:
561: // reference to the base type
562: private Ref.SimpleType baseType;
563:
564: // location of restriction
565: private Locator rloc;
566:
567: }
|