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