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