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_List extends NGCCHandler {
044: private Locator locator;
045: private AnnotationImpl annotation;
046: private String name;
047: private UName itemTypeName;
048: private Set finalSet;
049: private ForeignAttributesImpl fa;
050: protected final NGCCRuntimeEx $runtime;
051: private int $_ngcc_current_state;
052: protected String $uri;
053: protected String $localName;
054: protected String $qname;
055:
056: public final NGCCRuntime getRuntime() {
057: return ($runtime);
058: }
059:
060: public SimpleType_List(NGCCHandler parent, NGCCEventSource source,
061: NGCCRuntimeEx runtime, int cookie,
062: AnnotationImpl _annotation, Locator _locator,
063: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
064: super (source, parent, cookie);
065: $runtime = runtime;
066: this .annotation = _annotation;
067: this .locator = _locator;
068: this .fa = _fa;
069: this .name = _name;
070: this .finalSet = _finalSet;
071: $_ngcc_current_state = 10;
072: }
073:
074: public SimpleType_List(NGCCRuntimeEx runtime,
075: AnnotationImpl _annotation, Locator _locator,
076: ForeignAttributesImpl _fa, String _name, Set _finalSet) {
077: this (null, runtime, runtime, -1, _annotation, _locator, _fa,
078: _name, _finalSet);
079: }
080:
081: private void action0() throws SAXException {
082:
083: result = new ListSimpleTypeImpl($runtime.document, annotation,
084: locator, fa, name, name == null, finalSet, itemType);
085:
086: }
087:
088: private void action1() throws SAXException {
089:
090: itemType = new DelayedRef.SimpleType($runtime, lloc,
091: $runtime.currentSchema, itemTypeName);
092:
093: }
094:
095: private void action2() throws SAXException {
096: lloc = $runtime.copyLocator();
097: }
098:
099: public void enterElement(String $__uri, String $__local,
100: String $__qname, Attributes $attrs) throws SAXException {
101: int $ai;
102: $uri = $__uri;
103: $localName = $__local;
104: $qname = $__qname;
105: switch ($_ngcc_current_state) {
106: case 2: {
107: if (($ai = $runtime.getAttributeIndex("", "itemType")) >= 0) {
108: $runtime.consumeAttribute($ai);
109: $runtime.sendEnterElement(super ._cookie, $__uri,
110: $__local, $__qname, $attrs);
111: } else {
112: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
113: .equals("simpleType"))) {
114: NGCCHandler h = new simpleType(this , super ._source,
115: $runtime, 219);
116: spawnChildFromEnterElement(h, $__uri, $__local,
117: $__qname, $attrs);
118: } else {
119: unexpectedEnterElement($__qname);
120: }
121: }
122: }
123: break;
124: case 0: {
125: revertToParentFromEnterElement(result, super ._cookie,
126: $__uri, $__local, $__qname, $attrs);
127: }
128: break;
129: case 10: {
130: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
131: .equals("list"))) {
132: $runtime.onEnterElementConsumed($__uri, $__local,
133: $__qname, $attrs);
134: action2();
135: $_ngcc_current_state = 9;
136: } else {
137: unexpectedEnterElement($__qname);
138: }
139: }
140: break;
141: case 7: {
142: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
143: .equals("annotation"))) {
144: NGCCHandler h = new annotation(this , super ._source,
145: $runtime, 225, annotation,
146: AnnotationContext.SIMPLETYPE_DECL);
147: spawnChildFromEnterElement(h, $__uri, $__local,
148: $__qname, $attrs);
149: } else {
150: $_ngcc_current_state = 2;
151: $runtime.sendEnterElement(super ._cookie, $__uri,
152: $__local, $__qname, $attrs);
153: }
154: }
155: break;
156: case 9: {
157: if ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
158: .equals("annotation")) || ((($ai = $runtime
159: .getAttributeIndex("", "itemType")) >= 0 && (($__uri
160: .equals("http://www.w3.org/2001/XMLSchema") && $__local
161: .equals("simpleType")) || ($__uri
162: .equals("http://www.w3.org/2001/XMLSchema") && $__local
163: .equals("annotation")))) || ($__uri
164: .equals("http://www.w3.org/2001/XMLSchema") && $__local
165: .equals("simpleType"))))) {
166: NGCCHandler h = new foreignAttributes(this ,
167: super ._source, $runtime, 227, fa);
168: spawnChildFromEnterElement(h, $__uri, $__local,
169: $__qname, $attrs);
170: } else {
171: unexpectedEnterElement($__qname);
172: }
173: }
174: break;
175: default: {
176: unexpectedEnterElement($__qname);
177: }
178: break;
179: }
180: }
181:
182: public void leaveElement(String $__uri, String $__local,
183: String $__qname) throws SAXException {
184: int $ai;
185: $uri = $__uri;
186: $localName = $__local;
187: $qname = $__qname;
188: switch ($_ngcc_current_state) {
189: case 2: {
190: if (($ai = $runtime.getAttributeIndex("", "itemType")) >= 0) {
191: $runtime.consumeAttribute($ai);
192: $runtime.sendLeaveElement(super ._cookie, $__uri,
193: $__local, $__qname);
194: } else {
195: unexpectedLeaveElement($__qname);
196: }
197: }
198: break;
199: case 0: {
200: revertToParentFromLeaveElement(result, super ._cookie,
201: $__uri, $__local, $__qname);
202: }
203: break;
204: case 1: {
205: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
206: .equals("list"))) {
207: $runtime.onLeaveElementConsumed($__uri, $__local,
208: $__qname);
209: $_ngcc_current_state = 0;
210: action0();
211: } else {
212: unexpectedLeaveElement($__qname);
213: }
214: }
215: break;
216: case 7: {
217: $_ngcc_current_state = 2;
218: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
219: $__qname);
220: }
221: break;
222: case 9: {
223: if ((($ai = $runtime.getAttributeIndex("", "itemType")) >= 0 && ($__uri
224: .equals("http://www.w3.org/2001/XMLSchema") && $__local
225: .equals("list")))) {
226: NGCCHandler h = new foreignAttributes(this ,
227: super ._source, $runtime, 227, fa);
228: spawnChildFromLeaveElement(h, $__uri, $__local,
229: $__qname);
230: } else {
231: unexpectedLeaveElement($__qname);
232: }
233: }
234: break;
235: default: {
236: unexpectedLeaveElement($__qname);
237: }
238: break;
239: }
240: }
241:
242: public void enterAttribute(String $__uri, String $__local,
243: String $__qname) throws SAXException {
244: int $ai;
245: $uri = $__uri;
246: $localName = $__local;
247: $qname = $__qname;
248: switch ($_ngcc_current_state) {
249: case 2: {
250: if (($__uri.equals("") && $__local.equals("itemType"))) {
251: $_ngcc_current_state = 5;
252: } else {
253: unexpectedEnterAttribute($__qname);
254: }
255: }
256: break;
257: case 0: {
258: revertToParentFromEnterAttribute(result, super ._cookie,
259: $__uri, $__local, $__qname);
260: }
261: break;
262: case 7: {
263: $_ngcc_current_state = 2;
264: $runtime.sendEnterAttribute(super ._cookie, $__uri,
265: $__local, $__qname);
266: }
267: break;
268: case 9: {
269: if (($__uri.equals("") && $__local.equals("itemType"))) {
270: NGCCHandler h = new foreignAttributes(this ,
271: super ._source, $runtime, 227, fa);
272: spawnChildFromEnterAttribute(h, $__uri, $__local,
273: $__qname);
274: } else {
275: unexpectedEnterAttribute($__qname);
276: }
277: }
278: break;
279: default: {
280: unexpectedEnterAttribute($__qname);
281: }
282: break;
283: }
284: }
285:
286: public void leaveAttribute(String $__uri, String $__local,
287: String $__qname) throws SAXException {
288: int $ai;
289: $uri = $__uri;
290: $localName = $__local;
291: $qname = $__qname;
292: switch ($_ngcc_current_state) {
293: case 0: {
294: revertToParentFromLeaveAttribute(result, super ._cookie,
295: $__uri, $__local, $__qname);
296: }
297: break;
298: case 7: {
299: $_ngcc_current_state = 2;
300: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
301: $__local, $__qname);
302: }
303: break;
304: case 4: {
305: if (($__uri.equals("") && $__local.equals("itemType"))) {
306: $_ngcc_current_state = 1;
307: } else {
308: unexpectedLeaveAttribute($__qname);
309: }
310: }
311: break;
312: default: {
313: unexpectedLeaveAttribute($__qname);
314: }
315: break;
316: }
317: }
318:
319: public void text(String $value) throws SAXException {
320: int $ai;
321: switch ($_ngcc_current_state) {
322: case 5: {
323: NGCCHandler h = new qname(this , super ._source, $runtime,
324: 221);
325: spawnChildFromText(h, $value);
326: }
327: break;
328: case 2: {
329: if (($ai = $runtime.getAttributeIndex("", "itemType")) >= 0) {
330: $runtime.consumeAttribute($ai);
331: $runtime.sendText(super ._cookie, $value);
332: }
333: }
334: break;
335: case 0: {
336: revertToParentFromText(result, super ._cookie, $value);
337: }
338: break;
339: case 7: {
340: $_ngcc_current_state = 2;
341: $runtime.sendText(super ._cookie, $value);
342: }
343: break;
344: case 9: {
345: if (($ai = $runtime.getAttributeIndex("", "itemType")) >= 0) {
346: NGCCHandler h = new foreignAttributes(this ,
347: super ._source, $runtime, 227, fa);
348: spawnChildFromText(h, $value);
349: }
350: }
351: break;
352: }
353: }
354:
355: public void onChildCompleted(Object $__result__, int $__cookie__,
356: boolean $__needAttCheck__) throws SAXException {
357: switch ($__cookie__) {
358: case 221: {
359: itemTypeName = ((UName) $__result__);
360: action1();
361: $_ngcc_current_state = 4;
362: }
363: break;
364: case 219: {
365: itemType = ((SimpleTypeImpl) $__result__);
366: $_ngcc_current_state = 1;
367: }
368: break;
369: case 227: {
370: fa = ((ForeignAttributesImpl) $__result__);
371: $_ngcc_current_state = 7;
372: }
373: break;
374: case 225: {
375: annotation = ((AnnotationImpl) $__result__);
376: $_ngcc_current_state = 2;
377: }
378: break;
379: }
380: }
381:
382: public boolean accepted() {
383: return (($_ngcc_current_state == 0));
384: }
385:
386: /** computed simple type object */
387: private ListSimpleTypeImpl result;
388:
389: // reference to the base type
390: private Ref.SimpleType itemType;
391:
392: // locator of <list>
393: private Locator lloc;
394:
395: }
|