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 occurs extends NGCCHandler {
044: private String v;
045: protected final NGCCRuntimeEx $runtime;
046: private int $_ngcc_current_state;
047: protected String $uri;
048: protected String $localName;
049: protected String $qname;
050:
051: public final NGCCRuntime getRuntime() {
052: return ($runtime);
053: }
054:
055: public occurs(NGCCHandler parent, NGCCEventSource source,
056: NGCCRuntimeEx runtime, int cookie) {
057: super (source, parent, cookie);
058: $runtime = runtime;
059: $_ngcc_current_state = 5;
060: }
061:
062: public occurs(NGCCRuntimeEx runtime) {
063: this (null, runtime, runtime, -1);
064: }
065:
066: private void action0() throws SAXException {
067: min = Integer.parseInt(v);
068: }
069:
070: private void action1() throws SAXException {
071: max = -1;
072: }
073:
074: private void action2() throws SAXException {
075: max = Integer.parseInt(v);
076: }
077:
078: public void enterElement(String $__uri, String $__local,
079: String $__qname, Attributes $attrs) throws SAXException {
080: int $ai;
081: $uri = $__uri;
082: $localName = $__local;
083: $qname = $__qname;
084: switch ($_ngcc_current_state) {
085: case 5: {
086: if (($ai = $runtime.getAttributeIndex("", "maxOccurs")) >= 0) {
087: $runtime.consumeAttribute($ai);
088: $runtime.sendEnterElement(super ._cookie, $__uri,
089: $__local, $__qname, $attrs);
090: } else {
091: $_ngcc_current_state = 1;
092: $runtime.sendEnterElement(super ._cookie, $__uri,
093: $__local, $__qname, $attrs);
094: }
095: }
096: break;
097: case 0: {
098: revertToParentFromEnterElement(this , super ._cookie, $__uri,
099: $__local, $__qname, $attrs);
100: }
101: break;
102: case 1: {
103: if (($ai = $runtime.getAttributeIndex("", "minOccurs")) >= 0) {
104: $runtime.consumeAttribute($ai);
105: $runtime.sendEnterElement(super ._cookie, $__uri,
106: $__local, $__qname, $attrs);
107: } else {
108: $_ngcc_current_state = 0;
109: $runtime.sendEnterElement(super ._cookie, $__uri,
110: $__local, $__qname, $attrs);
111: }
112: }
113: break;
114: default: {
115: unexpectedEnterElement($__qname);
116: }
117: break;
118: }
119: }
120:
121: public void leaveElement(String $__uri, String $__local,
122: String $__qname) throws SAXException {
123: int $ai;
124: $uri = $__uri;
125: $localName = $__local;
126: $qname = $__qname;
127: switch ($_ngcc_current_state) {
128: case 5: {
129: if (($ai = $runtime.getAttributeIndex("", "maxOccurs")) >= 0) {
130: $runtime.consumeAttribute($ai);
131: $runtime.sendLeaveElement(super ._cookie, $__uri,
132: $__local, $__qname);
133: } else {
134: $_ngcc_current_state = 1;
135: $runtime.sendLeaveElement(super ._cookie, $__uri,
136: $__local, $__qname);
137: }
138: }
139: break;
140: case 0: {
141: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
142: $__local, $__qname);
143: }
144: break;
145: case 1: {
146: if (($ai = $runtime.getAttributeIndex("", "minOccurs")) >= 0) {
147: $runtime.consumeAttribute($ai);
148: $runtime.sendLeaveElement(super ._cookie, $__uri,
149: $__local, $__qname);
150: } else {
151: $_ngcc_current_state = 0;
152: $runtime.sendLeaveElement(super ._cookie, $__uri,
153: $__local, $__qname);
154: }
155: }
156: break;
157: default: {
158: unexpectedLeaveElement($__qname);
159: }
160: break;
161: }
162: }
163:
164: public void enterAttribute(String $__uri, String $__local,
165: String $__qname) throws SAXException {
166: int $ai;
167: $uri = $__uri;
168: $localName = $__local;
169: $qname = $__qname;
170: switch ($_ngcc_current_state) {
171: case 5: {
172: if (($__uri.equals("") && $__local.equals("maxOccurs"))) {
173: $_ngcc_current_state = 7;
174: } else {
175: $_ngcc_current_state = 1;
176: $runtime.sendEnterAttribute(super ._cookie, $__uri,
177: $__local, $__qname);
178: }
179: }
180: break;
181: case 0: {
182: revertToParentFromEnterAttribute(this , super ._cookie,
183: $__uri, $__local, $__qname);
184: }
185: break;
186: case 1: {
187: if (($__uri.equals("") && $__local.equals("minOccurs"))) {
188: $_ngcc_current_state = 3;
189: } else {
190: $_ngcc_current_state = 0;
191: $runtime.sendEnterAttribute(super ._cookie, $__uri,
192: $__local, $__qname);
193: }
194: }
195: break;
196: default: {
197: unexpectedEnterAttribute($__qname);
198: }
199: break;
200: }
201: }
202:
203: public void leaveAttribute(String $__uri, String $__local,
204: String $__qname) throws SAXException {
205: int $ai;
206: $uri = $__uri;
207: $localName = $__local;
208: $qname = $__qname;
209: switch ($_ngcc_current_state) {
210: case 5: {
211: $_ngcc_current_state = 1;
212: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
213: $__local, $__qname);
214: }
215: break;
216: case 2: {
217: if (($__uri.equals("") && $__local.equals("minOccurs"))) {
218: $_ngcc_current_state = 0;
219: } else {
220: unexpectedLeaveAttribute($__qname);
221: }
222: }
223: break;
224: case 6: {
225: if (($__uri.equals("") && $__local.equals("maxOccurs"))) {
226: $_ngcc_current_state = 1;
227: } else {
228: unexpectedLeaveAttribute($__qname);
229: }
230: }
231: break;
232: case 0: {
233: revertToParentFromLeaveAttribute(this , super ._cookie,
234: $__uri, $__local, $__qname);
235: }
236: break;
237: case 1: {
238: $_ngcc_current_state = 0;
239: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
240: $__local, $__qname);
241: }
242: break;
243: default: {
244: unexpectedLeaveAttribute($__qname);
245: }
246: break;
247: }
248: }
249:
250: public void text(String $value) throws SAXException {
251: int $ai;
252: switch ($_ngcc_current_state) {
253: case 5: {
254: if (($ai = $runtime.getAttributeIndex("", "maxOccurs")) >= 0) {
255: $runtime.consumeAttribute($ai);
256: $runtime.sendText(super ._cookie, $value);
257: } else {
258: $_ngcc_current_state = 1;
259: $runtime.sendText(super ._cookie, $value);
260: }
261: }
262: break;
263: case 7: {
264: if ($value.equals("unbounded")) {
265: $_ngcc_current_state = 6;
266: action1();
267: } else {
268: v = $value;
269: $_ngcc_current_state = 6;
270: action2();
271: }
272: }
273: break;
274: case 3: {
275: v = $value;
276: $_ngcc_current_state = 2;
277: action0();
278: }
279: break;
280: case 0: {
281: revertToParentFromText(this , super ._cookie, $value);
282: }
283: break;
284: case 1: {
285: if (($ai = $runtime.getAttributeIndex("", "minOccurs")) >= 0) {
286: $runtime.consumeAttribute($ai);
287: $runtime.sendText(super ._cookie, $value);
288: } else {
289: $_ngcc_current_state = 0;
290: $runtime.sendText(super ._cookie, $value);
291: }
292: }
293: break;
294: }
295: }
296:
297: public void onChildCompleted(Object $__result__, int $__cookie__,
298: boolean $__needAttCheck__) throws SAXException {
299: switch ($__cookie__) {
300: }
301: }
302:
303: public boolean accepted() {
304: return ((($_ngcc_current_state == 1) || (($_ngcc_current_state == 0) || ($_ngcc_current_state == 5))));
305: }
306:
307: int max = 1;
308: int min = 1;
309:
310: }
|