1 /* 2 * Copyright (c) 1997, 2012, 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.tools.internal.jxc.gen.config; 28 import org.xml.sax.SAXException; 29 import org.xml.sax.XMLReader; 30 import org.xml.sax.Attributes; 31 import com.sun.tools.internal.jxc.NGCCRuntimeEx; 32 33 import java.io.File; 34 35 36 public class Schema extends NGCCHandler { 37 private File baseDir; 38 private String loc; 39 protected final NGCCRuntimeEx $runtime; 40 private int $_ngcc_current_state; 41 protected String $uri; 42 protected String $localName; 43 protected String $qname; 44 45 public final NGCCRuntime getRuntime() { 46 return($runtime); 47 } 48 49 public Schema(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, File _baseDir) { 50 super(source, parent, cookie); 51 $runtime = runtime; 52 this.baseDir = _baseDir; 53 $_ngcc_current_state = 10; 54 } 55 56 public Schema(NGCCRuntimeEx runtime, File _baseDir) { 57 this(null, runtime, runtime, -1, _baseDir); 58 } 59 60 private void action0()throws SAXException { 61 location = new File(baseDir,loc); 62 } 63 64 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { 65 int $ai; 66 $uri = $__uri; 67 $localName = $__local; 68 $qname = $__qname; 69 switch($_ngcc_current_state) { 70 case 2: 71 { 72 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 73 $runtime.consumeAttribute($ai); 74 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 75 } 76 else { 77 $_ngcc_current_state = 1; 78 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 79 } 80 } 81 break; 82 case 10: 83 { 84 if(($__uri.equals("") && $__local.equals("schema"))) { 85 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); 86 $_ngcc_current_state = 6; 87 } 88 else { 89 unexpectedEnterElement($__qname); 90 } 91 } 92 break; 93 case 0: 94 { 95 revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs); 96 } 97 break; 98 case 6: 99 { 100 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 101 $runtime.consumeAttribute($ai); 102 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 103 } 104 else { 105 $_ngcc_current_state = 2; 106 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 107 } 108 } 109 break; 110 default: 111 { 112 unexpectedEnterElement($__qname); 113 } 114 break; 115 } 116 } 117 118 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { 119 int $ai; 120 $uri = $__uri; 121 $localName = $__local; 122 $qname = $__qname; 123 switch($_ngcc_current_state) { 124 case 1: 125 { 126 if(($__uri.equals("") && $__local.equals("schema"))) { 127 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); 128 $_ngcc_current_state = 0; 129 } 130 else { 131 unexpectedLeaveElement($__qname); 132 } 133 } 134 break; 135 case 2: 136 { 137 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 138 $runtime.consumeAttribute($ai); 139 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 140 } 141 else { 142 $_ngcc_current_state = 1; 143 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 144 } 145 } 146 break; 147 case 0: 148 { 149 revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); 150 } 151 break; 152 case 6: 153 { 154 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 155 $runtime.consumeAttribute($ai); 156 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 157 } 158 else { 159 $_ngcc_current_state = 2; 160 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 161 } 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 2: 179 { 180 if(($__uri.equals("") && $__local.equals("location"))) { 181 $_ngcc_current_state = 4; 182 } 183 else { 184 $_ngcc_current_state = 1; 185 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 186 } 187 } 188 break; 189 case 0: 190 { 191 revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); 192 } 193 break; 194 case 6: 195 { 196 if(($__uri.equals("") && $__local.equals("namespace"))) { 197 $_ngcc_current_state = 8; 198 } 199 else { 200 $_ngcc_current_state = 2; 201 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 202 } 203 } 204 break; 205 default: 206 { 207 unexpectedEnterAttribute($__qname); 208 } 209 break; 210 } 211 } 212 213 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 214 int $ai; 215 $uri = $__uri; 216 $localName = $__local; 217 $qname = $__qname; 218 switch($_ngcc_current_state) { 219 case 2: 220 { 221 $_ngcc_current_state = 1; 222 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 223 } 224 break; 225 case 7: 226 { 227 if(($__uri.equals("") && $__local.equals("namespace"))) { 228 $_ngcc_current_state = 2; 229 } 230 else { 231 unexpectedLeaveAttribute($__qname); 232 } 233 } 234 break; 235 case 3: 236 { 237 if(($__uri.equals("") && $__local.equals("location"))) { 238 $_ngcc_current_state = 1; 239 } 240 else { 241 unexpectedLeaveAttribute($__qname); 242 } 243 } 244 break; 245 case 0: 246 { 247 revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); 248 } 249 break; 250 case 6: 251 { 252 $_ngcc_current_state = 2; 253 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 254 } 255 break; 256 default: 257 { 258 unexpectedLeaveAttribute($__qname); 259 } 260 break; 261 } 262 } 263 264 public void text(String $value) throws SAXException { 265 int $ai; 266 switch($_ngcc_current_state) { 267 case 2: 268 { 269 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 270 $runtime.consumeAttribute($ai); 271 $runtime.sendText(super._cookie, $value); 272 } 273 else { 274 $_ngcc_current_state = 1; 275 $runtime.sendText(super._cookie, $value); 276 } 277 } 278 break; 279 case 4: 280 { 281 loc = $value; 282 $_ngcc_current_state = 3; 283 action0(); 284 } 285 break; 286 case 8: 287 { 288 namespace = $value; 289 $_ngcc_current_state = 7; 290 } 291 break; 292 case 0: 293 { 294 revertToParentFromText(this, super._cookie, $value); 295 } 296 break; 297 case 6: 298 { 299 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 300 $runtime.consumeAttribute($ai); 301 $runtime.sendText(super._cookie, $value); 302 } 303 else { 304 $_ngcc_current_state = 2; 305 $runtime.sendText(super._cookie, $value); 306 } 307 } 308 break; 309 } 310 } 311 312 public void onChildCompleted(Object result, int cookie, boolean needAttCheck)throws SAXException { 313 switch(cookie) { 314 } 315 } 316 317 public boolean accepted() { 318 return(($_ngcc_current_state == 0)); 319 } 320 321 322 private File location; 323 private String namespace; 324 public String getNamespace() { return this.namespace;} 325 public File getLocation() { return this.location;} 326 327 }