|
1 /* |
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 /* this file is generated by RelaxNGCC */ |
|
27 package com.sun.xml.internal.xsom.impl.parser.state; |
|
28 import org.xml.sax.SAXException; |
|
29 import org.xml.sax.XMLReader; |
|
30 import org.xml.sax.Attributes; |
|
31 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx; |
|
32 |
|
33 import com.sun.xml.internal.xsom.*; |
|
34 import com.sun.xml.internal.xsom.parser.*; |
|
35 import com.sun.xml.internal.xsom.impl.*; |
|
36 import com.sun.xml.internal.xsom.impl.parser.*; |
|
37 import org.xml.sax.Locator; |
|
38 import org.xml.sax.ContentHandler; |
|
39 import org.xml.sax.helpers.*; |
|
40 import java.util.*; |
|
41 import java.math.BigInteger; |
|
42 |
|
43 |
|
44 |
|
45 class attributeDeclBody extends NGCCHandler { |
|
46 private String name; |
|
47 private ForeignAttributesImpl fa; |
|
48 private AnnotationImpl annotation; |
|
49 private Locator locator; |
|
50 private boolean isLocal; |
|
51 private String defaultValue; |
|
52 private UName typeName; |
|
53 private String fixedValue; |
|
54 protected final NGCCRuntimeEx $runtime; |
|
55 private int $_ngcc_current_state; |
|
56 protected String $uri; |
|
57 protected String $localName; |
|
58 protected String $qname; |
|
59 |
|
60 public final NGCCRuntime getRuntime() { |
|
61 return($runtime); |
|
62 } |
|
63 |
|
64 public attributeDeclBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, boolean _isLocal, String _defaultValue, String _fixedValue) { |
|
65 super(source, parent, cookie); |
|
66 $runtime = runtime; |
|
67 this.locator = _locator; |
|
68 this.isLocal = _isLocal; |
|
69 this.defaultValue = _defaultValue; |
|
70 this.fixedValue = _fixedValue; |
|
71 $_ngcc_current_state = 13; |
|
72 } |
|
73 |
|
74 public attributeDeclBody(NGCCRuntimeEx runtime, Locator _locator, boolean _isLocal, String _defaultValue, String _fixedValue) { |
|
75 this(null, runtime, runtime, -1, _locator, _isLocal, _defaultValue, _fixedValue); |
|
76 } |
|
77 |
|
78 private void action0()throws SAXException { |
|
79 |
|
80 type = new DelayedRef.SimpleType( |
|
81 $runtime, locator, $runtime.currentSchema, typeName ); |
|
82 |
|
83 } |
|
84 |
|
85 private void action1()throws SAXException { |
|
86 formSpecified = true; |
|
87 } |
|
88 |
|
89 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { |
|
90 int $ai; |
|
91 $uri = $__uri; |
|
92 $localName = $__local; |
|
93 $qname = $__qname; |
|
94 switch($_ngcc_current_state) { |
|
95 case 0: |
|
96 { |
|
97 revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs); |
|
98 } |
|
99 break; |
|
100 case 12: |
|
101 { |
|
102 if(($ai = $runtime.getAttributeIndex("","name"))>=0) { |
|
103 $runtime.consumeAttribute($ai); |
|
104 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
105 } |
|
106 else { |
|
107 unexpectedEnterElement($__qname); |
|
108 } |
|
109 } |
|
110 break; |
|
111 case 7: |
|
112 { |
|
113 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { |
|
114 NGCCHandler h = new annotation(this, super._source, $runtime, 388, null,AnnotationContext.ATTRIBUTE_DECL); |
|
115 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
116 } |
|
117 else { |
|
118 $_ngcc_current_state = 1; |
|
119 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
120 } |
|
121 } |
|
122 break; |
|
123 case 9: |
|
124 { |
|
125 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ((($ai = $runtime.getAttributeIndex("","type"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))))) { |
|
126 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
127 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
128 } |
|
129 else { |
|
130 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
131 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
132 } |
|
133 } |
|
134 break; |
|
135 case 13: |
|
136 { |
|
137 if(($ai = $runtime.getAttributeIndex("","form"))>=0) { |
|
138 $runtime.consumeAttribute($ai); |
|
139 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
140 } |
|
141 else { |
|
142 $_ngcc_current_state = 12; |
|
143 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
144 } |
|
145 } |
|
146 break; |
|
147 case 1: |
|
148 { |
|
149 if(($ai = $runtime.getAttributeIndex("","type"))>=0) { |
|
150 $runtime.consumeAttribute($ai); |
|
151 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
152 } |
|
153 else { |
|
154 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) { |
|
155 NGCCHandler h = new simpleType(this, super._source, $runtime, 379); |
|
156 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
157 } |
|
158 else { |
|
159 $_ngcc_current_state = 0; |
|
160 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
161 } |
|
162 } |
|
163 } |
|
164 break; |
|
165 default: |
|
166 { |
|
167 unexpectedEnterElement($__qname); |
|
168 } |
|
169 break; |
|
170 } |
|
171 } |
|
172 |
|
173 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { |
|
174 int $ai; |
|
175 $uri = $__uri; |
|
176 $localName = $__local; |
|
177 $qname = $__qname; |
|
178 switch($_ngcc_current_state) { |
|
179 case 0: |
|
180 { |
|
181 revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
182 } |
|
183 break; |
|
184 case 12: |
|
185 { |
|
186 if(($ai = $runtime.getAttributeIndex("","name"))>=0) { |
|
187 $runtime.consumeAttribute($ai); |
|
188 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
189 } |
|
190 else { |
|
191 unexpectedLeaveElement($__qname); |
|
192 } |
|
193 } |
|
194 break; |
|
195 case 7: |
|
196 { |
|
197 $_ngcc_current_state = 1; |
|
198 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
199 } |
|
200 break; |
|
201 case 9: |
|
202 { |
|
203 if(($ai = $runtime.getAttributeIndex("","type"))>=0) { |
|
204 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
205 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); |
|
206 } |
|
207 else { |
|
208 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
209 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); |
|
210 } |
|
211 } |
|
212 break; |
|
213 case 13: |
|
214 { |
|
215 if(($ai = $runtime.getAttributeIndex("","form"))>=0) { |
|
216 $runtime.consumeAttribute($ai); |
|
217 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
218 } |
|
219 else { |
|
220 $_ngcc_current_state = 12; |
|
221 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
222 } |
|
223 } |
|
224 break; |
|
225 case 1: |
|
226 { |
|
227 if(($ai = $runtime.getAttributeIndex("","type"))>=0) { |
|
228 $runtime.consumeAttribute($ai); |
|
229 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
230 } |
|
231 else { |
|
232 $_ngcc_current_state = 0; |
|
233 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
234 } |
|
235 } |
|
236 break; |
|
237 default: |
|
238 { |
|
239 unexpectedLeaveElement($__qname); |
|
240 } |
|
241 break; |
|
242 } |
|
243 } |
|
244 |
|
245 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { |
|
246 int $ai; |
|
247 $uri = $__uri; |
|
248 $localName = $__local; |
|
249 $qname = $__qname; |
|
250 switch($_ngcc_current_state) { |
|
251 case 0: |
|
252 { |
|
253 revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
254 } |
|
255 break; |
|
256 case 12: |
|
257 { |
|
258 if(($__uri.equals("") && $__local.equals("name"))) { |
|
259 $_ngcc_current_state = 11; |
|
260 } |
|
261 else { |
|
262 unexpectedEnterAttribute($__qname); |
|
263 } |
|
264 } |
|
265 break; |
|
266 case 7: |
|
267 { |
|
268 $_ngcc_current_state = 1; |
|
269 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
270 } |
|
271 break; |
|
272 case 9: |
|
273 { |
|
274 if(($__uri.equals("") && $__local.equals("type"))) { |
|
275 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
276 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); |
|
277 } |
|
278 else { |
|
279 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
280 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); |
|
281 } |
|
282 } |
|
283 break; |
|
284 case 13: |
|
285 { |
|
286 if(($__uri.equals("") && $__local.equals("form"))) { |
|
287 $_ngcc_current_state = 15; |
|
288 } |
|
289 else { |
|
290 $_ngcc_current_state = 12; |
|
291 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
292 } |
|
293 } |
|
294 break; |
|
295 case 1: |
|
296 { |
|
297 if(($__uri.equals("") && $__local.equals("type"))) { |
|
298 $_ngcc_current_state = 5; |
|
299 } |
|
300 else { |
|
301 $_ngcc_current_state = 0; |
|
302 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
303 } |
|
304 } |
|
305 break; |
|
306 default: |
|
307 { |
|
308 unexpectedEnterAttribute($__qname); |
|
309 } |
|
310 break; |
|
311 } |
|
312 } |
|
313 |
|
314 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { |
|
315 int $ai; |
|
316 $uri = $__uri; |
|
317 $localName = $__local; |
|
318 $qname = $__qname; |
|
319 switch($_ngcc_current_state) { |
|
320 case 0: |
|
321 { |
|
322 revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
323 } |
|
324 break; |
|
325 case 14: |
|
326 { |
|
327 if(($__uri.equals("") && $__local.equals("form"))) { |
|
328 $_ngcc_current_state = 12; |
|
329 } |
|
330 else { |
|
331 unexpectedLeaveAttribute($__qname); |
|
332 } |
|
333 } |
|
334 break; |
|
335 case 7: |
|
336 { |
|
337 $_ngcc_current_state = 1; |
|
338 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
339 } |
|
340 break; |
|
341 case 10: |
|
342 { |
|
343 if(($__uri.equals("") && $__local.equals("name"))) { |
|
344 $_ngcc_current_state = 9; |
|
345 } |
|
346 else { |
|
347 unexpectedLeaveAttribute($__qname); |
|
348 } |
|
349 } |
|
350 break; |
|
351 case 9: |
|
352 { |
|
353 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
354 spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname); |
|
355 } |
|
356 break; |
|
357 case 13: |
|
358 { |
|
359 $_ngcc_current_state = 12; |
|
360 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
361 } |
|
362 break; |
|
363 case 1: |
|
364 { |
|
365 $_ngcc_current_state = 0; |
|
366 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
367 } |
|
368 break; |
|
369 case 4: |
|
370 { |
|
371 if(($__uri.equals("") && $__local.equals("type"))) { |
|
372 $_ngcc_current_state = 0; |
|
373 } |
|
374 else { |
|
375 unexpectedLeaveAttribute($__qname); |
|
376 } |
|
377 } |
|
378 break; |
|
379 default: |
|
380 { |
|
381 unexpectedLeaveAttribute($__qname); |
|
382 } |
|
383 break; |
|
384 } |
|
385 } |
|
386 |
|
387 public void text(String $value) throws SAXException { |
|
388 int $ai; |
|
389 switch($_ngcc_current_state) { |
|
390 case 0: |
|
391 { |
|
392 revertToParentFromText(makeResult(), super._cookie, $value); |
|
393 } |
|
394 break; |
|
395 case 12: |
|
396 { |
|
397 if(($ai = $runtime.getAttributeIndex("","name"))>=0) { |
|
398 $runtime.consumeAttribute($ai); |
|
399 $runtime.sendText(super._cookie, $value); |
|
400 } |
|
401 } |
|
402 break; |
|
403 case 7: |
|
404 { |
|
405 $_ngcc_current_state = 1; |
|
406 $runtime.sendText(super._cookie, $value); |
|
407 } |
|
408 break; |
|
409 case 9: |
|
410 { |
|
411 if(($ai = $runtime.getAttributeIndex("","type"))>=0) { |
|
412 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
413 spawnChildFromText(h, $value); |
|
414 } |
|
415 else { |
|
416 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 390, fa); |
|
417 spawnChildFromText(h, $value); |
|
418 } |
|
419 } |
|
420 break; |
|
421 case 13: |
|
422 { |
|
423 if(($ai = $runtime.getAttributeIndex("","form"))>=0) { |
|
424 $runtime.consumeAttribute($ai); |
|
425 $runtime.sendText(super._cookie, $value); |
|
426 } |
|
427 else { |
|
428 $_ngcc_current_state = 12; |
|
429 $runtime.sendText(super._cookie, $value); |
|
430 } |
|
431 } |
|
432 break; |
|
433 case 15: |
|
434 { |
|
435 if($value.equals("unqualified")) { |
|
436 NGCCHandler h = new qualification(this, super._source, $runtime, 395); |
|
437 spawnChildFromText(h, $value); |
|
438 } |
|
439 else { |
|
440 if($value.equals("qualified")) { |
|
441 NGCCHandler h = new qualification(this, super._source, $runtime, 395); |
|
442 spawnChildFromText(h, $value); |
|
443 } |
|
444 } |
|
445 } |
|
446 break; |
|
447 case 1: |
|
448 { |
|
449 if(($ai = $runtime.getAttributeIndex("","type"))>=0) { |
|
450 $runtime.consumeAttribute($ai); |
|
451 $runtime.sendText(super._cookie, $value); |
|
452 } |
|
453 else { |
|
454 $_ngcc_current_state = 0; |
|
455 $runtime.sendText(super._cookie, $value); |
|
456 } |
|
457 } |
|
458 break; |
|
459 case 11: |
|
460 { |
|
461 name = $value; |
|
462 $_ngcc_current_state = 10; |
|
463 } |
|
464 break; |
|
465 case 5: |
|
466 { |
|
467 NGCCHandler h = new qname(this, super._source, $runtime, 381); |
|
468 spawnChildFromText(h, $value); |
|
469 } |
|
470 break; |
|
471 } |
|
472 } |
|
473 |
|
474 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { |
|
475 switch($__cookie__) { |
|
476 case 388: |
|
477 { |
|
478 annotation = ((AnnotationImpl)$__result__); |
|
479 $_ngcc_current_state = 1; |
|
480 } |
|
481 break; |
|
482 case 379: |
|
483 { |
|
484 type = ((SimpleTypeImpl)$__result__); |
|
485 $_ngcc_current_state = 0; |
|
486 } |
|
487 break; |
|
488 case 390: |
|
489 { |
|
490 fa = ((ForeignAttributesImpl)$__result__); |
|
491 $_ngcc_current_state = 7; |
|
492 } |
|
493 break; |
|
494 case 395: |
|
495 { |
|
496 form = ((Boolean)$__result__).booleanValue(); |
|
497 action1(); |
|
498 $_ngcc_current_state = 14; |
|
499 } |
|
500 break; |
|
501 case 381: |
|
502 { |
|
503 typeName = ((UName)$__result__); |
|
504 action0(); |
|
505 $_ngcc_current_state = 4; |
|
506 } |
|
507 break; |
|
508 } |
|
509 } |
|
510 |
|
511 public boolean accepted() { |
|
512 return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 1) || ($_ngcc_current_state == 7)))); |
|
513 } |
|
514 |
|
515 |
|
516 private boolean form; |
|
517 private boolean formSpecified = false; |
|
518 |
|
519 private AttributeDeclImpl makeResult() { |
|
520 |
|
521 if(type==null) |
|
522 // type defaults to anySimpleType |
|
523 type = $runtime.parser.schemaSet.anySimpleType; |
|
524 |
|
525 if(!formSpecified) form = $runtime.attributeFormDefault; |
|
526 // global attributes are always qualified |
|
527 if(!isLocal) form = true; |
|
528 |
|
529 String tns; |
|
530 if(form==true) tns = $runtime.currentSchema.getTargetNamespace(); |
|
531 else tns = ""; |
|
532 |
|
533 // proper handling of anonymous types |
|
534 return new AttributeDeclImpl( $runtime.document, tns, name, |
|
535 annotation, locator, fa, isLocal, |
|
536 $runtime.createXmlString(defaultValue), |
|
537 $runtime.createXmlString(fixedValue), |
|
538 type ); |
|
539 } |
|
540 private Ref.SimpleType type; |
|
541 |
|
542 } |