|
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 import java.util.StringTokenizer; |
|
44 import java.util.HashSet; |
|
45 |
|
46 |
|
47 class wildcardBody extends NGCCHandler { |
|
48 private AnnotationImpl annotation; |
|
49 private Locator locator; |
|
50 private String modeValue; |
|
51 private String ns; |
|
52 private ForeignAttributesImpl fa; |
|
53 protected final NGCCRuntimeEx $runtime; |
|
54 private int $_ngcc_current_state; |
|
55 protected String $uri; |
|
56 protected String $localName; |
|
57 protected String $qname; |
|
58 |
|
59 public final NGCCRuntime getRuntime() { |
|
60 return($runtime); |
|
61 } |
|
62 |
|
63 public wildcardBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator) { |
|
64 super(source, parent, cookie); |
|
65 $runtime = runtime; |
|
66 this.locator = _locator; |
|
67 $_ngcc_current_state = 10; |
|
68 } |
|
69 |
|
70 public wildcardBody(NGCCRuntimeEx runtime, Locator _locator) { |
|
71 this(null, runtime, runtime, -1, _locator); |
|
72 } |
|
73 |
|
74 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { |
|
75 int $ai; |
|
76 $uri = $__uri; |
|
77 $localName = $__local; |
|
78 $qname = $__qname; |
|
79 switch($_ngcc_current_state) { |
|
80 case 1: |
|
81 { |
|
82 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { |
|
83 $runtime.consumeAttribute($ai); |
|
84 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
85 } |
|
86 else { |
|
87 $_ngcc_current_state = 0; |
|
88 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
89 } |
|
90 } |
|
91 break; |
|
92 case 5: |
|
93 { |
|
94 if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { |
|
95 $runtime.consumeAttribute($ai); |
|
96 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
97 } |
|
98 else { |
|
99 $_ngcc_current_state = 1; |
|
100 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
101 } |
|
102 } |
|
103 break; |
|
104 case 9: |
|
105 { |
|
106 if((($ai = $runtime.getAttributeIndex("","namespace"))>=0 || ($ai = $runtime.getAttributeIndex("","processContents"))>=0)) { |
|
107 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
108 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
109 } |
|
110 else { |
|
111 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
112 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
113 } |
|
114 } |
|
115 break; |
|
116 case 10: |
|
117 { |
|
118 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { |
|
119 NGCCHandler h = new annotation(this, super._source, $runtime, 411, null,AnnotationContext.WILDCARD); |
|
120 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); |
|
121 } |
|
122 else { |
|
123 $_ngcc_current_state = 9; |
|
124 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); |
|
125 } |
|
126 } |
|
127 break; |
|
128 case 0: |
|
129 { |
|
130 revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs); |
|
131 } |
|
132 break; |
|
133 default: |
|
134 { |
|
135 unexpectedEnterElement($__qname); |
|
136 } |
|
137 break; |
|
138 } |
|
139 } |
|
140 |
|
141 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { |
|
142 int $ai; |
|
143 $uri = $__uri; |
|
144 $localName = $__local; |
|
145 $qname = $__qname; |
|
146 switch($_ngcc_current_state) { |
|
147 case 1: |
|
148 { |
|
149 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { |
|
150 $runtime.consumeAttribute($ai); |
|
151 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
152 } |
|
153 else { |
|
154 $_ngcc_current_state = 0; |
|
155 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
156 } |
|
157 } |
|
158 break; |
|
159 case 5: |
|
160 { |
|
161 if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { |
|
162 $runtime.consumeAttribute($ai); |
|
163 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
164 } |
|
165 else { |
|
166 $_ngcc_current_state = 1; |
|
167 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
168 } |
|
169 } |
|
170 break; |
|
171 case 9: |
|
172 { |
|
173 if((($ai = $runtime.getAttributeIndex("","namespace"))>=0 || ($ai = $runtime.getAttributeIndex("","processContents"))>=0)) { |
|
174 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
175 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); |
|
176 } |
|
177 else { |
|
178 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
179 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); |
|
180 } |
|
181 } |
|
182 break; |
|
183 case 10: |
|
184 { |
|
185 $_ngcc_current_state = 9; |
|
186 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); |
|
187 } |
|
188 break; |
|
189 case 0: |
|
190 { |
|
191 revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
192 } |
|
193 break; |
|
194 default: |
|
195 { |
|
196 unexpectedLeaveElement($__qname); |
|
197 } |
|
198 break; |
|
199 } |
|
200 } |
|
201 |
|
202 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { |
|
203 int $ai; |
|
204 $uri = $__uri; |
|
205 $localName = $__local; |
|
206 $qname = $__qname; |
|
207 switch($_ngcc_current_state) { |
|
208 case 1: |
|
209 { |
|
210 if(($__uri.equals("") && $__local.equals("namespace"))) { |
|
211 $_ngcc_current_state = 3; |
|
212 } |
|
213 else { |
|
214 $_ngcc_current_state = 0; |
|
215 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
216 } |
|
217 } |
|
218 break; |
|
219 case 5: |
|
220 { |
|
221 if(($__uri.equals("") && $__local.equals("processContents"))) { |
|
222 $_ngcc_current_state = 7; |
|
223 } |
|
224 else { |
|
225 $_ngcc_current_state = 1; |
|
226 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
227 } |
|
228 } |
|
229 break; |
|
230 case 9: |
|
231 { |
|
232 if((($__uri.equals("") && $__local.equals("namespace")) || ($__uri.equals("") && $__local.equals("processContents")))) { |
|
233 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
234 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); |
|
235 } |
|
236 else { |
|
237 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
238 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); |
|
239 } |
|
240 } |
|
241 break; |
|
242 case 10: |
|
243 { |
|
244 $_ngcc_current_state = 9; |
|
245 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); |
|
246 } |
|
247 break; |
|
248 case 0: |
|
249 { |
|
250 revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
251 } |
|
252 break; |
|
253 default: |
|
254 { |
|
255 unexpectedEnterAttribute($__qname); |
|
256 } |
|
257 break; |
|
258 } |
|
259 } |
|
260 |
|
261 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { |
|
262 int $ai; |
|
263 $uri = $__uri; |
|
264 $localName = $__local; |
|
265 $qname = $__qname; |
|
266 switch($_ngcc_current_state) { |
|
267 case 1: |
|
268 { |
|
269 $_ngcc_current_state = 0; |
|
270 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
271 } |
|
272 break; |
|
273 case 5: |
|
274 { |
|
275 $_ngcc_current_state = 1; |
|
276 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
277 } |
|
278 break; |
|
279 case 6: |
|
280 { |
|
281 if(($__uri.equals("") && $__local.equals("processContents"))) { |
|
282 $_ngcc_current_state = 1; |
|
283 } |
|
284 else { |
|
285 unexpectedLeaveAttribute($__qname); |
|
286 } |
|
287 } |
|
288 break; |
|
289 case 9: |
|
290 { |
|
291 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
292 spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname); |
|
293 } |
|
294 break; |
|
295 case 10: |
|
296 { |
|
297 $_ngcc_current_state = 9; |
|
298 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); |
|
299 } |
|
300 break; |
|
301 case 0: |
|
302 { |
|
303 revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); |
|
304 } |
|
305 break; |
|
306 case 2: |
|
307 { |
|
308 if(($__uri.equals("") && $__local.equals("namespace"))) { |
|
309 $_ngcc_current_state = 0; |
|
310 } |
|
311 else { |
|
312 unexpectedLeaveAttribute($__qname); |
|
313 } |
|
314 } |
|
315 break; |
|
316 default: |
|
317 { |
|
318 unexpectedLeaveAttribute($__qname); |
|
319 } |
|
320 break; |
|
321 } |
|
322 } |
|
323 |
|
324 public void text(String $value) throws SAXException { |
|
325 int $ai; |
|
326 switch($_ngcc_current_state) { |
|
327 case 1: |
|
328 { |
|
329 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { |
|
330 $runtime.consumeAttribute($ai); |
|
331 $runtime.sendText(super._cookie, $value); |
|
332 } |
|
333 else { |
|
334 $_ngcc_current_state = 0; |
|
335 $runtime.sendText(super._cookie, $value); |
|
336 } |
|
337 } |
|
338 break; |
|
339 case 3: |
|
340 { |
|
341 ns = $value; |
|
342 $_ngcc_current_state = 2; |
|
343 } |
|
344 break; |
|
345 case 5: |
|
346 { |
|
347 if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { |
|
348 $runtime.consumeAttribute($ai); |
|
349 $runtime.sendText(super._cookie, $value); |
|
350 } |
|
351 else { |
|
352 $_ngcc_current_state = 1; |
|
353 $runtime.sendText(super._cookie, $value); |
|
354 } |
|
355 } |
|
356 break; |
|
357 case 9: |
|
358 { |
|
359 if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { |
|
360 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
361 spawnChildFromText(h, $value); |
|
362 } |
|
363 else { |
|
364 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { |
|
365 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
366 spawnChildFromText(h, $value); |
|
367 } |
|
368 else { |
|
369 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); |
|
370 spawnChildFromText(h, $value); |
|
371 } |
|
372 } |
|
373 } |
|
374 break; |
|
375 case 10: |
|
376 { |
|
377 $_ngcc_current_state = 9; |
|
378 $runtime.sendText(super._cookie, $value); |
|
379 } |
|
380 break; |
|
381 case 0: |
|
382 { |
|
383 revertToParentFromText(makeResult(), super._cookie, $value); |
|
384 } |
|
385 break; |
|
386 case 7: |
|
387 { |
|
388 modeValue = $value; |
|
389 $_ngcc_current_state = 6; |
|
390 } |
|
391 break; |
|
392 } |
|
393 } |
|
394 |
|
395 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { |
|
396 switch($__cookie__) { |
|
397 case 409: |
|
398 { |
|
399 fa = ((ForeignAttributesImpl)$__result__); |
|
400 $_ngcc_current_state = 5; |
|
401 } |
|
402 break; |
|
403 case 411: |
|
404 { |
|
405 annotation = ((AnnotationImpl)$__result__); |
|
406 $_ngcc_current_state = 9; |
|
407 } |
|
408 break; |
|
409 } |
|
410 } |
|
411 |
|
412 public boolean accepted() { |
|
413 return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 5) || ($_ngcc_current_state == 1)))); |
|
414 } |
|
415 |
|
416 |
|
417 private WildcardImpl makeResult() { |
|
418 if(modeValue==null) modeValue="strict"; |
|
419 |
|
420 int mode=-1; |
|
421 if(modeValue.equals("strict")) mode = XSWildcard.STRTICT; |
|
422 if(modeValue.equals("lax")) mode = XSWildcard.LAX; |
|
423 if(modeValue.equals("skip")) mode = XSWildcard.SKIP; |
|
424 if(mode==-1) throw new InternalError(); |
|
425 |
|
426 if(ns==null || ns.equals("##any")) |
|
427 return new WildcardImpl.Any( $runtime.document, annotation,locator,fa,mode); |
|
428 |
|
429 if(ns.equals("##other")) |
|
430 return new WildcardImpl.Other( $runtime.document, |
|
431 annotation,locator,fa, |
|
432 $runtime.currentSchema.getTargetNamespace(),mode); |
|
433 |
|
434 StringTokenizer tokens = new StringTokenizer(ns); |
|
435 HashSet s = new HashSet(); |
|
436 while(tokens.hasMoreTokens()) { |
|
437 String ns = tokens.nextToken(); |
|
438 if(ns.equals("##local")) ns=""; |
|
439 if(ns.equals("##targetNamespace")) ns=$runtime.currentSchema.getTargetNamespace(); |
|
440 s.add(ns); |
|
441 } |
|
442 |
|
443 return new WildcardImpl.Finite( $runtime.document, annotation,locator,fa,s,mode); |
|
444 } |
|
445 |
|
446 } |