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