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 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 3:
  87             {
  88                 action0();
  89                 $_ngcc_current_state = 2;
  90                 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
  91             }
  92             break;
  93         case 13:
  94             {
  95                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
  96                     $runtime.consumeAttribute($ai);
  97                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
  98                 }
  99                 else {
 100                     unexpectedEnterElement($__qname);
 101                 }
 102             }
 103             break;
 104         case 4:
 105             {
 106                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
 107                     NGCCHandler h = new annotation(this, super._source, $runtime, 525, null,AnnotationContext.ATTRIBUTE_GROUP);
 108                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 109                 }
 110                 else {
 111                     $_ngcc_current_state = 3;
 112                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 113                 }
 114             }
 115             break;
 116         case 14:
 117             {
 118                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
 119                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 120                     action1();
 121                     $_ngcc_current_state = 13;
 122                 }
 123                 else {
 124                     unexpectedEnterElement($__qname);
 125                 }
 126             }
 127             break;
 128         case 7:
 129             {
 130                 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
 131                     $runtime.consumeAttribute($ai);
 132                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 133                 }
 134                 else {
 135                     $_ngcc_current_state = 6;
 136                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 137                 }
 138             }
 139             break;
 140         case 6:
 141             {
 142                 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")))))) {
 143                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 527, fa);
 144                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 145                 }
 146                 else {
 147                     unexpectedEnterElement($__qname);
 148                 }
 149             }
 150             break;
 151         case 2:
 152             {
 153                 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))))) {
 154                     NGCCHandler h = new attributeUses(this, super._source, $runtime, 522, result);
 155                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 156                 }
 157                 else {
 158                     unexpectedEnterElement($__qname);
 159                 }
 160             }
 161             break;
 162         case 0:
 163             {
 164                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
 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 3:
 182             {
 183                 action0();
 184                 $_ngcc_current_state = 2;
 185                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 186             }
 187             break;
 188         case 13:
 189             {
 190                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 191                     $runtime.consumeAttribute($ai);
 192                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 193                 }
 194                 else {
 195                     unexpectedLeaveElement($__qname);
 196                 }
 197             }
 198             break;
 199         case 1:
 200             {
 201                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
 202                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 203                     $_ngcc_current_state = 0;
 204                 }
 205                 else {
 206                     unexpectedLeaveElement($__qname);
 207                 }
 208             }
 209             break;
 210         case 4:
 211             {
 212                 $_ngcc_current_state = 3;
 213                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 214             }
 215             break;
 216         case 7:
 217             {
 218                 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
 219                     $runtime.consumeAttribute($ai);
 220                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 221                 }
 222                 else {
 223                     $_ngcc_current_state = 6;
 224                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 225                 }
 226             }
 227             break;
 228         case 6:
 229             {
 230                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
 231                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 527, fa);
 232                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
 233                 }
 234                 else {
 235                     unexpectedLeaveElement($__qname);
 236                 }
 237             }
 238             break;
 239         case 2:
 240             {
 241                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
 242                     NGCCHandler h = new attributeUses(this, super._source, $runtime, 522, result);
 243                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
 244                 }
 245                 else {
 246                     unexpectedLeaveElement($__qname);
 247                 }
 248             }
 249             break;
 250         case 0:
 251             {
 252                 revertToParentFromLeaveElement(result, 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 3:
 270             {
 271                 action0();
 272                 $_ngcc_current_state = 2;
 273                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 274             }
 275             break;
 276         case 13:
 277             {
 278                 if(($__uri.equals("") && $__local.equals("name"))) {
 279                     $_ngcc_current_state = 12;
 280                 }
 281                 else {
 282                     unexpectedEnterAttribute($__qname);
 283                 }
 284             }
 285             break;
 286         case 4:
 287             {
 288                 $_ngcc_current_state = 3;
 289                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 290             }
 291             break;
 292         case 7:
 293             {
 294                 if(($__uri.equals("") && $__local.equals("id"))) {
 295                     $_ngcc_current_state = 9;
 296                 }
 297                 else {
 298                     $_ngcc_current_state = 6;
 299                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 300                 }
 301             }
 302             break;
 303         case 0:
 304             {
 305                 revertToParentFromEnterAttribute(result, 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 8:
 323             {
 324                 if(($__uri.equals("") && $__local.equals("id"))) {
 325                     $_ngcc_current_state = 6;
 326                 }
 327                 else {
 328                     unexpectedLeaveAttribute($__qname);
 329                 }
 330             }
 331             break;
 332         case 3:
 333             {
 334                 action0();
 335                 $_ngcc_current_state = 2;
 336                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 337             }
 338             break;
 339         case 11:
 340             {
 341                 if(($__uri.equals("") && $__local.equals("name"))) {
 342                     $_ngcc_current_state = 7;
 343                 }
 344                 else {
 345                     unexpectedLeaveAttribute($__qname);
 346                 }
 347             }
 348             break;
 349         case 4:
 350             {
 351                 $_ngcc_current_state = 3;
 352                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 353             }
 354             break;
 355         case 7:
 356             {
 357                 $_ngcc_current_state = 6;
 358                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 359             }
 360             break;
 361         case 0:
 362             {
 363                 revertToParentFromLeaveAttribute(result, 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 3:
 378             {
 379                 action0();
 380                 $_ngcc_current_state = 2;
 381                 $runtime.sendText(super._cookie, $value);
 382             }
 383             break;
 384         case 13:
 385             {
 386                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 387                     $runtime.consumeAttribute($ai);
 388                     $runtime.sendText(super._cookie, $value);
 389                 }
 390             }
 391             break;
 392         case 12:
 393             {
 394                 name = $value;
 395                 $_ngcc_current_state = 11;
 396             }
 397             break;
 398         case 4:
 399             {
 400                 $_ngcc_current_state = 3;
 401                 $runtime.sendText(super._cookie, $value);
 402             }
 403             break;
 404         case 9:
 405             {
 406                 $_ngcc_current_state = 8;
 407             }
 408             break;
 409         case 7:
 410             {
 411                 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
 412                     $runtime.consumeAttribute($ai);
 413                     $runtime.sendText(super._cookie, $value);
 414                 }
 415                 else {
 416                     $_ngcc_current_state = 6;
 417                     $runtime.sendText(super._cookie, $value);
 418                 }
 419             }
 420             break;
 421         case 0:
 422             {
 423                 revertToParentFromText(result, 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 525:
 432             {
 433                 annotation = ((AnnotationImpl)$__result__);
 434                 $_ngcc_current_state = 3;
 435             }
 436             break;
 437         case 527:
 438             {
 439                 fa = ((ForeignAttributesImpl)$__result__);
 440                 $_ngcc_current_state = 4;
 441             }
 442             break;
 443         case 522:
 444             {
 445                 $_ngcc_current_state = 1;
 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 }