Mon, 02 Oct 2017 14:20:23 +0100
8159240: XSOM parser incorrectly processes type names with whitespaces
Reviewed-by: coffeys
1 /*
2 * Copyright (c) 1997, 2017, 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 */
26 /* this file is generated by RelaxNGCC */
27 package com.sun.xml.internal.xsom.impl.parser.state;
29 import com.sun.xml.internal.bind.WhiteSpaceProcessor;
30 import com.sun.xml.internal.xsom.impl.*;
31 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
32 import com.sun.xml.internal.xsom.parser.*;
34 import org.xml.sax.Attributes;
35 import org.xml.sax.Locator;
36 import org.xml.sax.SAXException;
38 class group extends NGCCHandler {
39 private AnnotationImpl annotation;
40 private String name;
41 private ModelGroupImpl term;
42 private ForeignAttributesImpl fa;
43 protected final NGCCRuntimeEx $runtime;
44 private int $_ngcc_current_state;
45 protected String $uri;
46 protected String $localName;
47 protected String $qname;
49 public final NGCCRuntime getRuntime() {
50 return($runtime);
51 }
53 public group(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
54 super(source, parent, cookie);
55 $runtime = runtime;
56 $_ngcc_current_state = 15;
57 }
59 public group(NGCCRuntimeEx runtime) {
60 this(null, runtime, runtime, -1);
61 }
63 private void action0()throws SAXException {
65 result = new ModelGroupDeclImpl( $runtime.document,
66 annotation, loc, fa,
67 $runtime.currentSchema.getTargetNamespace(),
68 name,
69 term
70 );
72 }
74 private void action1()throws SAXException {
76 mloc = $runtime.copyLocator();
77 compositorName = $localName;
79 }
81 private void action2()throws SAXException {
82 loc = $runtime.copyLocator();
83 }
85 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
86 int $ai;
87 $uri = $__uri;
88 $localName = $__local;
89 $qname = $__qname;
90 switch($_ngcc_current_state) {
91 case 10:
92 {
93 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
94 $runtime.consumeAttribute($ai);
95 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
96 }
97 else {
98 unexpectedEnterElement($__qname);
99 }
100 }
101 break;
102 case 5:
103 {
104 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
105 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 357, null);
106 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
107 }
108 else {
109 unexpectedEnterElement($__qname);
110 }
111 }
112 break;
113 case 11:
114 {
115 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
116 $runtime.consumeAttribute($ai);
117 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
118 }
119 else {
120 $_ngcc_current_state = 10;
121 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
122 }
123 }
124 break;
125 case 6:
126 {
127 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
128 NGCCHandler h = new annotation(this, super._source, $runtime, 359, null,AnnotationContext.MODELGROUP_DECL);
129 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
130 }
131 else {
132 $_ngcc_current_state = 5;
133 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
134 }
135 }
136 break;
137 case 0:
138 {
139 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
140 }
141 break;
142 case 4:
143 {
144 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
145 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
146 $_ngcc_current_state = 3;
147 }
148 else {
149 unexpectedEnterElement($__qname);
150 }
151 }
152 break;
153 case 15:
154 {
155 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
156 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
157 action2();
158 $_ngcc_current_state = 11;
159 }
160 else {
161 unexpectedEnterElement($__qname);
162 }
163 }
164 break;
165 case 3:
166 {
167 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")) || ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))))))) {
168 NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
169 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
170 }
171 else {
172 unexpectedEnterElement($__qname);
173 }
174 }
175 break;
176 default:
177 {
178 unexpectedEnterElement($__qname);
179 }
180 break;
181 }
182 }
184 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
185 int $ai;
186 $uri = $__uri;
187 $localName = $__local;
188 $qname = $__qname;
189 switch($_ngcc_current_state) {
190 case 10:
191 {
192 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
193 $runtime.consumeAttribute($ai);
194 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
195 }
196 else {
197 unexpectedLeaveElement($__qname);
198 }
199 }
200 break;
201 case 11:
202 {
203 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
204 $runtime.consumeAttribute($ai);
205 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
206 }
207 else {
208 $_ngcc_current_state = 10;
209 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
210 }
211 }
212 break;
213 case 1:
214 {
215 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
216 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
217 $_ngcc_current_state = 0;
218 action0();
219 }
220 else {
221 unexpectedLeaveElement($__qname);
222 }
223 }
224 break;
225 case 6:
226 {
227 $_ngcc_current_state = 5;
228 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
229 }
230 break;
231 case 0:
232 {
233 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
234 }
235 break;
236 case 2:
237 {
238 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
239 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
240 $_ngcc_current_state = 1;
241 }
242 else {
243 unexpectedLeaveElement($__qname);
244 }
245 }
246 break;
247 case 3:
248 {
249 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
250 NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
251 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
252 }
253 else {
254 unexpectedLeaveElement($__qname);
255 }
256 }
257 break;
258 default:
259 {
260 unexpectedLeaveElement($__qname);
261 }
262 break;
263 }
264 }
266 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
267 int $ai;
268 $uri = $__uri;
269 $localName = $__local;
270 $qname = $__qname;
271 switch($_ngcc_current_state) {
272 case 10:
273 {
274 if(($__uri.equals("") && $__local.equals("name"))) {
275 $_ngcc_current_state = 9;
276 }
277 else {
278 unexpectedEnterAttribute($__qname);
279 }
280 }
281 break;
282 case 11:
283 {
284 if(($__uri.equals("") && $__local.equals("ID"))) {
285 $_ngcc_current_state = 13;
286 }
287 else {
288 $_ngcc_current_state = 10;
289 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
290 }
291 }
292 break;
293 case 6:
294 {
295 $_ngcc_current_state = 5;
296 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
297 }
298 break;
299 case 0:
300 {
301 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
302 }
303 break;
304 default:
305 {
306 unexpectedEnterAttribute($__qname);
307 }
308 break;
309 }
310 }
312 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
313 int $ai;
314 $uri = $__uri;
315 $localName = $__local;
316 $qname = $__qname;
317 switch($_ngcc_current_state) {
318 case 11:
319 {
320 $_ngcc_current_state = 10;
321 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
322 }
323 break;
324 case 6:
325 {
326 $_ngcc_current_state = 5;
327 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
328 }
329 break;
330 case 0:
331 {
332 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
333 }
334 break;
335 case 12:
336 {
337 if(($__uri.equals("") && $__local.equals("ID"))) {
338 $_ngcc_current_state = 10;
339 }
340 else {
341 unexpectedLeaveAttribute($__qname);
342 }
343 }
344 break;
345 case 8:
346 {
347 if(($__uri.equals("") && $__local.equals("name"))) {
348 $_ngcc_current_state = 6;
349 }
350 else {
351 unexpectedLeaveAttribute($__qname);
352 }
353 }
354 break;
355 default:
356 {
357 unexpectedLeaveAttribute($__qname);
358 }
359 break;
360 }
361 }
363 public void text(String $value) throws SAXException {
364 int $ai;
365 switch($_ngcc_current_state) {
366 case 10:
367 {
368 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
369 $runtime.consumeAttribute($ai);
370 $runtime.sendText(super._cookie, $value);
371 }
372 }
373 break;
374 case 11:
375 {
376 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
377 $runtime.consumeAttribute($ai);
378 $runtime.sendText(super._cookie, $value);
379 }
380 else {
381 $_ngcc_current_state = 10;
382 $runtime.sendText(super._cookie, $value);
383 }
384 }
385 break;
386 case 6:
387 {
388 $_ngcc_current_state = 5;
389 $runtime.sendText(super._cookie, $value);
390 }
391 break;
392 case 0:
393 {
394 revertToParentFromText(result, super._cookie, $value);
395 }
396 break;
397 case 9:
398 {
399 name = WhiteSpaceProcessor.collapse($value);
400 $_ngcc_current_state = 8;
401 }
402 break;
403 case 13:
404 {
405 $_ngcc_current_state = 12;
406 }
407 break;
408 }
409 }
411 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
412 switch($__cookie__) {
413 case 357:
414 {
415 fa = ((ForeignAttributesImpl)$__result__);
416 action1();
417 $_ngcc_current_state = 4;
418 }
419 break;
420 case 359:
421 {
422 annotation = ((AnnotationImpl)$__result__);
423 $_ngcc_current_state = 5;
424 }
425 break;
426 case 355:
427 {
428 term = ((ModelGroupImpl)$__result__);
429 $_ngcc_current_state = 2;
430 }
431 break;
432 }
433 }
435 public boolean accepted() {
436 return(($_ngcc_current_state == 0));
437 }
440 private ModelGroupDeclImpl result;
441 private Locator loc,mloc;
442 private String compositorName;
444 }