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.Vector; 44 45 46 class modelGroupBody extends NGCCHandler { 47 private AnnotationImpl annotation; 48 private String compositorName; 49 private Locator locator; 50 private ParticleImpl childParticle; 51 private ForeignAttributesImpl fa; 52 protected final NGCCRuntimeEx $runtime; 53 private int $_ngcc_current_state; 54 protected String $uri; 55 protected String $localName; 56 protected String $qname; 57 58 public final NGCCRuntime getRuntime() { 59 return($runtime); 60 } 61 62 public modelGroupBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, String _compositorName) { 63 super(source, parent, cookie); 64 $runtime = runtime; 65 this.locator = _locator; 66 this.compositorName = _compositorName; 67 $_ngcc_current_state = 6; 68 } 69 70 public modelGroupBody(NGCCRuntimeEx runtime, Locator _locator, String _compositorName) { 71 this(null, runtime, runtime, -1, _locator, _compositorName); 72 } 73 74 private void action0()throws SAXException { 75 76 XSModelGroup.Compositor compositor = null; 77 if(compositorName.equals("all")) compositor = XSModelGroup.ALL; 78 if(compositorName.equals("sequence")) compositor = XSModelGroup.SEQUENCE; 79 if(compositorName.equals("choice")) compositor = XSModelGroup.CHOICE; 80 if(compositor==null) 81 throw new InternalError("unable to process "+compositorName); 82 83 result = new ModelGroupImpl( $runtime.document, annotation, locator, fa, compositor, 84 (ParticleImpl[])particles.toArray(new ParticleImpl[0])); 85 86 } 87 88 private void action1()throws SAXException { 89 90 particles.add(childParticle); 91 92 } 93 94 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { 95 int $ai; 96 $uri = $__uri; 97 $localName = $__local; 98 $qname = $__qname; 99 switch($_ngcc_current_state) { 100 case 2: 101 { 102 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__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"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")))))) { 103 NGCCHandler h = new particle(this, super._source, $runtime, 515); 104 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 105 } 106 else { 107 $_ngcc_current_state = 1; 108 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 109 } 110 } 111 break; 112 case 6: 113 { 114 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__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"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element"))))))) { 115 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 116 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 117 } 118 else { 119 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 120 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 121 } 122 } 123 break; 124 case 1: 125 { 126 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__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"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")))))) { 127 NGCCHandler h = new particle(this, super._source, $runtime, 514); 128 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 129 } 130 else { 131 action0(); 132 $_ngcc_current_state = 0; 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("annotation"))) { 145 NGCCHandler h = new annotation(this, super._source, $runtime, 518, null,AnnotationContext.MODELGROUP); 146 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 147 } 148 else { 149 $_ngcc_current_state = 2; 150 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 151 } 152 } 153 break; 154 default: 155 { 156 unexpectedEnterElement($__qname); 157 } 158 break; 159 } 160 } 161 162 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { 163 int $ai; 164 $uri = $__uri; 165 $localName = $__local; 166 $qname = $__qname; 167 switch($_ngcc_current_state) { 168 case 2: 169 { 170 $_ngcc_current_state = 1; 171 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 172 } 173 break; 174 case 6: 175 { 176 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 177 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); 178 } 179 break; 180 case 1: 181 { 182 action0(); 183 $_ngcc_current_state = 0; 184 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 185 } 186 break; 187 case 0: 188 { 189 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname); 190 } 191 break; 192 case 4: 193 { 194 $_ngcc_current_state = 2; 195 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 196 } 197 break; 198 default: 199 { 200 unexpectedLeaveElement($__qname); 201 } 202 break; 203 } 204 } 205 206 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 207 int $ai; 208 $uri = $__uri; 209 $localName = $__local; 210 $qname = $__qname; 211 switch($_ngcc_current_state) { 212 case 2: 213 { 214 $_ngcc_current_state = 1; 215 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 216 } 217 break; 218 case 6: 219 { 220 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 221 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); 222 } 223 break; 224 case 1: 225 { 226 action0(); 227 $_ngcc_current_state = 0; 228 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 229 } 230 break; 231 case 0: 232 { 233 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname); 234 } 235 break; 236 case 4: 237 { 238 $_ngcc_current_state = 2; 239 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 240 } 241 break; 242 default: 243 { 244 unexpectedEnterAttribute($__qname); 245 } 246 break; 247 } 248 } 249 250 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 251 int $ai; 252 $uri = $__uri; 253 $localName = $__local; 254 $qname = $__qname; 255 switch($_ngcc_current_state) { 256 case 2: 257 { 258 $_ngcc_current_state = 1; 259 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 260 } 261 break; 262 case 6: 263 { 264 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 265 spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname); 266 } 267 break; 268 case 1: 269 { 270 action0(); 271 $_ngcc_current_state = 0; 272 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 273 } 274 break; 275 case 0: 276 { 277 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname); 278 } 279 break; 280 case 4: 281 { 282 $_ngcc_current_state = 2; 283 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 284 } 285 break; 286 default: 287 { 288 unexpectedLeaveAttribute($__qname); 289 } 290 break; 291 } 292 } 293 294 public void text(String $value) throws SAXException { 295 int $ai; 296 switch($_ngcc_current_state) { 297 case 2: 298 { 299 $_ngcc_current_state = 1; 300 $runtime.sendText(super._cookie, $value); 301 } 302 break; 303 case 6: 304 { 305 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 520, null); 306 spawnChildFromText(h, $value); 307 } 308 break; 309 case 1: 310 { 311 action0(); 312 $_ngcc_current_state = 0; 313 $runtime.sendText(super._cookie, $value); 314 } 315 break; 316 case 0: 317 { 318 revertToParentFromText(result, super._cookie, $value); 319 } 320 break; 321 case 4: 322 { 323 $_ngcc_current_state = 2; 324 $runtime.sendText(super._cookie, $value); 325 } 326 break; 327 } 328 } 329 330 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { 331 switch($__cookie__) { 332 case 520: 333 { 334 fa = ((ForeignAttributesImpl)$__result__); 335 $_ngcc_current_state = 4; 336 } 337 break; 338 case 515: 339 { 340 childParticle = ((ParticleImpl)$__result__); 341 action1(); 342 $_ngcc_current_state = 1; 343 } 344 break; 345 case 514: 346 { 347 childParticle = ((ParticleImpl)$__result__); 348 action1(); 349 $_ngcc_current_state = 1; 350 } 351 break; 352 case 518: 353 { 354 annotation = ((AnnotationImpl)$__result__); 355 $_ngcc_current_state = 2; 356 } 357 break; 358 } 359 } 360 361 public boolean accepted() { 362 return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 4) || (($_ngcc_current_state == 1) || ($_ngcc_current_state == 2))))); 363 } 364 365 366 private ModelGroupImpl result; 367 368 private final List particles = new ArrayList(); 369 370 }