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 identityConstraint extends NGCCHandler {
019: private String name;
020: private UName ref;
021: private ForeignAttributesImpl fa;
022: private AnnotationImpl ann;
023: private XPathImpl field;
024: protected final NGCCRuntimeEx $runtime;
025: private int $_ngcc_current_state;
026: protected String $uri;
027: protected String $localName;
028: protected String $qname;
029:
030: public final NGCCRuntime getRuntime() {
031: return ($runtime);
032: }
033:
034: public identityConstraint(NGCCHandler parent,
035: NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
036: super (source, parent, cookie);
037: $runtime = runtime;
038: $_ngcc_current_state = 18;
039: }
040:
041: public identityConstraint(NGCCRuntimeEx runtime) {
042: this (null, runtime, runtime, -1);
043: }
044:
045: private void action0() throws SAXException {
046: fields.add(field);
047: }
048:
049: private void action1() throws SAXException {
050:
051: refer = new DelayedRef.IdentityConstraint($runtime, $runtime
052: .copyLocator(), $runtime.currentSchema, ref);
053:
054: }
055:
056: private void action2() throws SAXException {
057: if ($localName.equals("key"))
058: category = XSIdentityConstraint.KEY;
059: else if ($localName.equals("keyref"))
060: category = XSIdentityConstraint.KEYREF;
061: else if ($localName.equals("unique"))
062: category = XSIdentityConstraint.UNIQUE;
063: }
064:
065: public void enterElement(String $__uri, String $__local,
066: String $__qname, Attributes $attrs) throws SAXException {
067: int $ai;
068: $uri = $__uri;
069: $localName = $__local;
070: $qname = $__qname;
071: switch ($_ngcc_current_state) {
072: case 10: {
073: if (($ai = $runtime.getAttributeIndex("", "refer")) >= 0) {
074: $runtime.consumeAttribute($ai);
075: $runtime.sendEnterElement(super ._cookie, $__uri,
076: $__local, $__qname, $attrs);
077: } else {
078: $_ngcc_current_state = 8;
079: $runtime.sendEnterElement(super ._cookie, $__uri,
080: $__local, $__qname, $attrs);
081: }
082: }
083: break;
084: case 6: {
085: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
086: NGCCHandler h = new xpath(this , super ._source,
087: $runtime, 653);
088: spawnChildFromEnterElement(h, $__uri, $__local,
089: $__qname, $attrs);
090: } else {
091: unexpectedEnterElement($__qname);
092: }
093: }
094: break;
095: case 16: {
096: if (($ai = $runtime.getAttributeIndex("", "name")) >= 0) {
097: $runtime.consumeAttribute($ai);
098: $runtime.sendEnterElement(super ._cookie, $__uri,
099: $__local, $__qname, $attrs);
100: } else {
101: unexpectedEnterElement($__qname);
102: }
103: }
104: break;
105: case 17: {
106: if ((($ai = $runtime.getAttributeIndex("", "name")) >= 0 && (($__uri
107: .equals("http://www.w3.org/2001/XMLSchema") && $__local
108: .equals("annotation")) || ($__uri
109: .equals("http://www.w3.org/2001/XMLSchema") && $__local
110: .equals("selector"))))) {
111: NGCCHandler h = new foreignAttributes(this ,
112: super ._source, $runtime, 666, null);
113: spawnChildFromEnterElement(h, $__uri, $__local,
114: $__qname, $attrs);
115: } else {
116: unexpectedEnterElement($__qname);
117: }
118: }
119: break;
120: case 0: {
121: revertToParentFromEnterElement(makeResult(), super ._cookie,
122: $__uri, $__local, $__qname, $attrs);
123: }
124: break;
125: case 18: {
126: if (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
127: .equals("key")) || ($__uri
128: .equals("http://www.w3.org/2001/XMLSchema") && $__local
129: .equals("keyref"))) || ($__uri
130: .equals("http://www.w3.org/2001/XMLSchema") && $__local
131: .equals("unique")))) {
132: $runtime.onEnterElementConsumed($__uri, $__local,
133: $__qname, $attrs);
134: action2();
135: $_ngcc_current_state = 17;
136: } else {
137: unexpectedEnterElement($__qname);
138: }
139: }
140: break;
141: case 1: {
142: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
143: .equals("field"))) {
144: $runtime.onEnterElementConsumed($__uri, $__local,
145: $__qname, $attrs);
146: $_ngcc_current_state = 3;
147: } else {
148: unexpectedEnterElement($__qname);
149: }
150: }
151: break;
152: case 4: {
153: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
154: .equals("field"))) {
155: $runtime.onEnterElementConsumed($__uri, $__local,
156: $__qname, $attrs);
157: $_ngcc_current_state = 3;
158: } else {
159: unexpectedEnterElement($__qname);
160: }
161: }
162: break;
163: case 8: {
164: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
165: .equals("annotation"))) {
166: NGCCHandler h = new annotation(this , super ._source,
167: $runtime, 656, null,
168: AnnotationContext.IDENTITY_CONSTRAINT);
169: spawnChildFromEnterElement(h, $__uri, $__local,
170: $__qname, $attrs);
171: } else {
172: $_ngcc_current_state = 7;
173: $runtime.sendEnterElement(super ._cookie, $__uri,
174: $__local, $__qname, $attrs);
175: }
176: }
177: break;
178: case 3: {
179: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
180: NGCCHandler h = new xpath(this , super ._source,
181: $runtime, 649);
182: spawnChildFromEnterElement(h, $__uri, $__local,
183: $__qname, $attrs);
184: } else {
185: unexpectedEnterElement($__qname);
186: }
187: }
188: break;
189: case 7: {
190: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
191: .equals("selector"))) {
192: $runtime.onEnterElementConsumed($__uri, $__local,
193: $__qname, $attrs);
194: $_ngcc_current_state = 6;
195: } else {
196: unexpectedEnterElement($__qname);
197: }
198: }
199: break;
200: default: {
201: unexpectedEnterElement($__qname);
202: }
203: break;
204: }
205: }
206:
207: public void leaveElement(String $__uri, String $__local,
208: String $__qname) throws SAXException {
209: int $ai;
210: $uri = $__uri;
211: $localName = $__local;
212: $qname = $__qname;
213: switch ($_ngcc_current_state) {
214: case 2: {
215: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
216: .equals("field"))) {
217: $runtime.onLeaveElementConsumed($__uri, $__local,
218: $__qname);
219: $_ngcc_current_state = 1;
220: } else {
221: unexpectedLeaveElement($__qname);
222: }
223: }
224: break;
225: case 5: {
226: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
227: .equals("selector"))) {
228: $runtime.onLeaveElementConsumed($__uri, $__local,
229: $__qname);
230: $_ngcc_current_state = 4;
231: } else {
232: unexpectedLeaveElement($__qname);
233: }
234: }
235: break;
236: case 10: {
237: if (($ai = $runtime.getAttributeIndex("", "refer")) >= 0) {
238: $runtime.consumeAttribute($ai);
239: $runtime.sendLeaveElement(super ._cookie, $__uri,
240: $__local, $__qname);
241: } else {
242: $_ngcc_current_state = 8;
243: $runtime.sendLeaveElement(super ._cookie, $__uri,
244: $__local, $__qname);
245: }
246: }
247: break;
248: case 6: {
249: if ((($ai = $runtime.getAttributeIndex("", "xpath")) >= 0 && ($__uri
250: .equals("http://www.w3.org/2001/XMLSchema") && $__local
251: .equals("selector")))) {
252: NGCCHandler h = new xpath(this , super ._source,
253: $runtime, 653);
254: spawnChildFromLeaveElement(h, $__uri, $__local,
255: $__qname);
256: } else {
257: unexpectedLeaveElement($__qname);
258: }
259: }
260: break;
261: case 16: {
262: if (($ai = $runtime.getAttributeIndex("", "name")) >= 0) {
263: $runtime.consumeAttribute($ai);
264: $runtime.sendLeaveElement(super ._cookie, $__uri,
265: $__local, $__qname);
266: } else {
267: unexpectedLeaveElement($__qname);
268: }
269: }
270: break;
271: case 17: {
272: if (($ai = $runtime.getAttributeIndex("", "name")) >= 0) {
273: NGCCHandler h = new foreignAttributes(this ,
274: super ._source, $runtime, 666, null);
275: spawnChildFromLeaveElement(h, $__uri, $__local,
276: $__qname);
277: } else {
278: unexpectedLeaveElement($__qname);
279: }
280: }
281: break;
282: case 0: {
283: revertToParentFromLeaveElement(makeResult(), super ._cookie,
284: $__uri, $__local, $__qname);
285: }
286: break;
287: case 1: {
288: if (((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
289: .equals("key")) || ($__uri
290: .equals("http://www.w3.org/2001/XMLSchema") && $__local
291: .equals("keyref"))) || ($__uri
292: .equals("http://www.w3.org/2001/XMLSchema") && $__local
293: .equals("unique")))) {
294: $runtime.onLeaveElementConsumed($__uri, $__local,
295: $__qname);
296: $_ngcc_current_state = 0;
297: } else {
298: unexpectedLeaveElement($__qname);
299: }
300: }
301: break;
302: case 8: {
303: $_ngcc_current_state = 7;
304: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
305: $__qname);
306: }
307: break;
308: case 3: {
309: if ((($ai = $runtime.getAttributeIndex("", "xpath")) >= 0 && ($__uri
310: .equals("http://www.w3.org/2001/XMLSchema") && $__local
311: .equals("field")))) {
312: NGCCHandler h = new xpath(this , super ._source,
313: $runtime, 649);
314: spawnChildFromLeaveElement(h, $__uri, $__local,
315: $__qname);
316: } else {
317: unexpectedLeaveElement($__qname);
318: }
319: }
320: break;
321: default: {
322: unexpectedLeaveElement($__qname);
323: }
324: break;
325: }
326: }
327:
328: public void enterAttribute(String $__uri, String $__local,
329: String $__qname) throws SAXException {
330: int $ai;
331: $uri = $__uri;
332: $localName = $__local;
333: $qname = $__qname;
334: switch ($_ngcc_current_state) {
335: case 10: {
336: if (($__uri.equals("") && $__local.equals("refer"))) {
337: $_ngcc_current_state = 12;
338: } else {
339: $_ngcc_current_state = 8;
340: $runtime.sendEnterAttribute(super ._cookie, $__uri,
341: $__local, $__qname);
342: }
343: }
344: break;
345: case 6: {
346: if (($__uri.equals("") && $__local.equals("xpath"))) {
347: NGCCHandler h = new xpath(this , super ._source,
348: $runtime, 653);
349: spawnChildFromEnterAttribute(h, $__uri, $__local,
350: $__qname);
351: } else {
352: unexpectedEnterAttribute($__qname);
353: }
354: }
355: break;
356: case 16: {
357: if (($__uri.equals("") && $__local.equals("name"))) {
358: $_ngcc_current_state = 15;
359: } else {
360: unexpectedEnterAttribute($__qname);
361: }
362: }
363: break;
364: case 17: {
365: if (($__uri.equals("") && $__local.equals("name"))) {
366: NGCCHandler h = new foreignAttributes(this ,
367: super ._source, $runtime, 666, null);
368: spawnChildFromEnterAttribute(h, $__uri, $__local,
369: $__qname);
370: } else {
371: unexpectedEnterAttribute($__qname);
372: }
373: }
374: break;
375: case 0: {
376: revertToParentFromEnterAttribute(makeResult(),
377: super ._cookie, $__uri, $__local, $__qname);
378: }
379: break;
380: case 8: {
381: $_ngcc_current_state = 7;
382: $runtime.sendEnterAttribute(super ._cookie, $__uri,
383: $__local, $__qname);
384: }
385: break;
386: case 3: {
387: if (($__uri.equals("") && $__local.equals("xpath"))) {
388: NGCCHandler h = new xpath(this , super ._source,
389: $runtime, 649);
390: spawnChildFromEnterAttribute(h, $__uri, $__local,
391: $__qname);
392: } else {
393: unexpectedEnterAttribute($__qname);
394: }
395: }
396: break;
397: default: {
398: unexpectedEnterAttribute($__qname);
399: }
400: break;
401: }
402: }
403:
404: public void leaveAttribute(String $__uri, String $__local,
405: String $__qname) throws SAXException {
406: int $ai;
407: $uri = $__uri;
408: $localName = $__local;
409: $qname = $__qname;
410: switch ($_ngcc_current_state) {
411: case 10: {
412: $_ngcc_current_state = 8;
413: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
414: $__local, $__qname);
415: }
416: break;
417: case 0: {
418: revertToParentFromLeaveAttribute(makeResult(),
419: super ._cookie, $__uri, $__local, $__qname);
420: }
421: break;
422: case 14: {
423: if (($__uri.equals("") && $__local.equals("name"))) {
424: $_ngcc_current_state = 10;
425: } else {
426: unexpectedLeaveAttribute($__qname);
427: }
428: }
429: break;
430: case 11: {
431: if (($__uri.equals("") && $__local.equals("refer"))) {
432: $_ngcc_current_state = 8;
433: } else {
434: unexpectedLeaveAttribute($__qname);
435: }
436: }
437: break;
438: case 8: {
439: $_ngcc_current_state = 7;
440: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
441: $__local, $__qname);
442: }
443: break;
444: default: {
445: unexpectedLeaveAttribute($__qname);
446: }
447: break;
448: }
449: }
450:
451: public void text(String $value) throws SAXException {
452: int $ai;
453: switch ($_ngcc_current_state) {
454: case 12: {
455: NGCCHandler h = new qname(this , super ._source, $runtime,
456: 659);
457: spawnChildFromText(h, $value);
458: }
459: break;
460: case 10: {
461: if (($ai = $runtime.getAttributeIndex("", "refer")) >= 0) {
462: $runtime.consumeAttribute($ai);
463: $runtime.sendText(super ._cookie, $value);
464: } else {
465: $_ngcc_current_state = 8;
466: $runtime.sendText(super ._cookie, $value);
467: }
468: }
469: break;
470: case 15: {
471: name = $value;
472: $_ngcc_current_state = 14;
473: }
474: break;
475: case 6: {
476: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
477: NGCCHandler h = new xpath(this , super ._source,
478: $runtime, 653);
479: spawnChildFromText(h, $value);
480: }
481: }
482: break;
483: case 16: {
484: if (($ai = $runtime.getAttributeIndex("", "name")) >= 0) {
485: $runtime.consumeAttribute($ai);
486: $runtime.sendText(super ._cookie, $value);
487: }
488: }
489: break;
490: case 17: {
491: if (($ai = $runtime.getAttributeIndex("", "name")) >= 0) {
492: NGCCHandler h = new foreignAttributes(this ,
493: super ._source, $runtime, 666, null);
494: spawnChildFromText(h, $value);
495: }
496: }
497: break;
498: case 0: {
499: revertToParentFromText(makeResult(), super ._cookie, $value);
500: }
501: break;
502: case 8: {
503: $_ngcc_current_state = 7;
504: $runtime.sendText(super ._cookie, $value);
505: }
506: break;
507: case 3: {
508: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
509: NGCCHandler h = new xpath(this , super ._source,
510: $runtime, 649);
511: spawnChildFromText(h, $value);
512: }
513: }
514: break;
515: }
516: }
517:
518: public void onChildCompleted(Object $__result__, int $__cookie__,
519: boolean $__needAttCheck__) throws SAXException {
520: switch ($__cookie__) {
521: case 666: {
522: fa = ((ForeignAttributesImpl) $__result__);
523: $_ngcc_current_state = 16;
524: }
525: break;
526: case 656: {
527: ann = ((AnnotationImpl) $__result__);
528: $_ngcc_current_state = 7;
529: }
530: break;
531: case 659: {
532: ref = ((UName) $__result__);
533: action1();
534: $_ngcc_current_state = 11;
535: }
536: break;
537: case 653: {
538: selector = ((XPathImpl) $__result__);
539: $_ngcc_current_state = 5;
540: }
541: break;
542: case 649: {
543: field = ((XPathImpl) $__result__);
544: action0();
545: $_ngcc_current_state = 2;
546: }
547: break;
548: }
549: }
550:
551: public boolean accepted() {
552: return (($_ngcc_current_state == 0));
553: }
554:
555: private short category;
556: private List fields = new ArrayList();
557: private XPathImpl selector;
558: private DelayedRef.IdentityConstraint refer = null;
559:
560: private IdentityConstraintImpl makeResult() {
561: return new IdentityConstraintImpl($runtime.document, ann,
562: $runtime.copyLocator(), fa, category, name, selector,
563: fields, refer);
564: }
565:
566: }
|