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