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 includeDecl extends NGCCHandler { 46 private String schemaLocation; 47 protected final NGCCRuntimeEx $runtime; 48 private int $_ngcc_current_state; 49 protected String $uri; 50 protected String $localName; 51 protected String $qname; 52 53 public final NGCCRuntime getRuntime() { 54 return($runtime); 55 } 56 57 public includeDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) { 58 super(source, parent, cookie); 59 $runtime = runtime; 60 $_ngcc_current_state = 7; 61 } 62 63 public includeDecl(NGCCRuntimeEx runtime) { 64 this(null, runtime, runtime, -1); 65 } 66 67 private void action0()throws SAXException { 68 $runtime.includeSchema( schemaLocation ); 69 } 70 71 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { 72 int $ai; 73 $uri = $__uri; 74 $localName = $__local; 75 $qname = $__qname; 76 switch($_ngcc_current_state) { 77 case 6: 78 { 79 if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) { 80 $runtime.consumeAttribute($ai); 81 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 82 } 83 else { 84 unexpectedEnterElement($__qname); 85 } 86 } 87 break; 88 case 2: 89 { 90 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { 91 NGCCHandler h = new annotation(this, super._source, $runtime, 610, null,AnnotationContext.SCHEMA); 92 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 93 } 94 else { 95 $_ngcc_current_state = 1; 96 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 97 } 98 } 99 break; 100 case 7: 101 { 102 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("include"))) { 103 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); 104 $_ngcc_current_state = 6; 105 } 106 else { 107 unexpectedEnterElement($__qname); 108 } 109 } 110 break; 111 case 0: 112 { 113 revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs); 114 } 115 break; 116 default: 117 { 118 unexpectedEnterElement($__qname); 119 } 120 break; 121 } 122 } 123 124 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { 125 int $ai; 126 $uri = $__uri; 127 $localName = $__local; 128 $qname = $__qname; 129 switch($_ngcc_current_state) { 130 case 6: 131 { 132 if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) { 133 $runtime.consumeAttribute($ai); 134 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 135 } 136 else { 137 unexpectedLeaveElement($__qname); 138 } 139 } 140 break; 141 case 1: 142 { 143 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("include"))) { 144 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); 145 $_ngcc_current_state = 0; 146 action0(); 147 } 148 else { 149 unexpectedLeaveElement($__qname); 150 } 151 } 152 break; 153 case 2: 154 { 155 $_ngcc_current_state = 1; 156 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 157 } 158 break; 159 case 0: 160 { 161 revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); 162 } 163 break; 164 default: 165 { 166 unexpectedLeaveElement($__qname); 167 } 168 break; 169 } 170 } 171 172 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 173 int $ai; 174 $uri = $__uri; 175 $localName = $__local; 176 $qname = $__qname; 177 switch($_ngcc_current_state) { 178 case 6: 179 { 180 if(($__uri.equals("") && $__local.equals("schemaLocation"))) { 181 $_ngcc_current_state = 5; 182 } 183 else { 184 unexpectedEnterAttribute($__qname); 185 } 186 } 187 break; 188 case 2: 189 { 190 $_ngcc_current_state = 1; 191 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 192 } 193 break; 194 case 0: 195 { 196 revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); 197 } 198 break; 199 default: 200 { 201 unexpectedEnterAttribute($__qname); 202 } 203 break; 204 } 205 } 206 207 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 208 int $ai; 209 $uri = $__uri; 210 $localName = $__local; 211 $qname = $__qname; 212 switch($_ngcc_current_state) { 213 case 4: 214 { 215 if(($__uri.equals("") && $__local.equals("schemaLocation"))) { 216 $_ngcc_current_state = 2; 217 } 218 else { 219 unexpectedLeaveAttribute($__qname); 220 } 221 } 222 break; 223 case 2: 224 { 225 $_ngcc_current_state = 1; 226 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 227 } 228 break; 229 case 0: 230 { 231 revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); 232 } 233 break; 234 default: 235 { 236 unexpectedLeaveAttribute($__qname); 237 } 238 break; 239 } 240 } 241 242 public void text(String $value) throws SAXException { 243 int $ai; 244 switch($_ngcc_current_state) { 245 case 5: 246 { 247 schemaLocation = $value; 248 $_ngcc_current_state = 4; 249 } 250 break; 251 case 6: 252 { 253 if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) { 254 $runtime.consumeAttribute($ai); 255 $runtime.sendText(super._cookie, $value); 256 } 257 } 258 break; 259 case 2: 260 { 261 $_ngcc_current_state = 1; 262 $runtime.sendText(super._cookie, $value); 263 } 264 break; 265 case 0: 266 { 267 revertToParentFromText(this, super._cookie, $value); 268 } 269 break; 270 } 271 } 272 273 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { 274 switch($__cookie__) { 275 case 610: 276 { 277 $_ngcc_current_state = 1; 278 } 279 break; 280 } 281 } 282 283 public boolean accepted() { 284 return(($_ngcc_current_state == 0)); 285 } 286 287 288 }