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 0: 71 { 72 revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs); 73 } 74 break; 75 case 6: 76 { 77 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 78 $runtime.consumeAttribute($ai); 79 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 80 } 81 else { 82 $_ngcc_current_state = 2; 83 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 84 } 85 } 86 break; 87 case 2: 88 { 89 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 90 $runtime.consumeAttribute($ai); 91 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 92 } 93 else { 94 $_ngcc_current_state = 1; 95 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 96 } 97 } 98 break; 99 case 10: 100 { 101 if(($__uri.equals("") && $__local.equals("schema"))) { 102 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); 103 $_ngcc_current_state = 6; 104 } 105 else { 106 unexpectedEnterElement($__qname); 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 0: 125 { 126 revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname); 127 } 128 break; 129 case 6: 130 { 131 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 132 $runtime.consumeAttribute($ai); 133 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 134 } 135 else { 136 $_ngcc_current_state = 2; 137 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 138 } 139 } 140 break; 141 case 2: 142 { 143 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 144 $runtime.consumeAttribute($ai); 145 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 146 } 147 else { 148 $_ngcc_current_state = 1; 149 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 150 } 151 } 152 break; 153 case 1: 154 { 155 if(($__uri.equals("") && $__local.equals("schema"))) { 156 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); 157 $_ngcc_current_state = 0; 158 } 159 else { 160 unexpectedLeaveElement($__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 0: 179 { 180 revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname); 181 } 182 break; 183 case 6: 184 { 185 if(($__uri.equals("") && $__local.equals("namespace"))) { 186 $_ngcc_current_state = 8; 187 } 188 else { 189 $_ngcc_current_state = 2; 190 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 191 } 192 } 193 break; 194 case 2: 195 { 196 if(($__uri.equals("") && $__local.equals("location"))) { 197 $_ngcc_current_state = 4; 198 } 199 else { 200 $_ngcc_current_state = 1; 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 0: 220 { 221 revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname); 222 } 223 break; 224 case 7: 225 { 226 if(($__uri.equals("") && $__local.equals("namespace"))) { 227 $_ngcc_current_state = 2; 228 } 229 else { 230 unexpectedLeaveAttribute($__qname); 231 } 232 } 233 break; 234 case 6: 235 { 236 $_ngcc_current_state = 2; 237 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); 238 } 239 break; 240 case 3: 241 { 242 if(($__uri.equals("") && $__local.equals("location"))) { 243 $_ngcc_current_state = 1; 244 } 245 else { 246 unexpectedLeaveAttribute($__qname); 247 } 248 } 249 break; 250 case 2: 251 { 252 $_ngcc_current_state = 1; 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 8: 268 { 269 namespace = $value; 270 $_ngcc_current_state = 7; 271 } 272 break; 273 case 0: 274 { 275 revertToParentFromText(this, super._cookie, $value); 276 } 277 break; 278 case 6: 279 { 280 if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { 281 $runtime.consumeAttribute($ai); 282 $runtime.sendText(super._cookie, $value); 283 } 284 else { 285 $_ngcc_current_state = 2; 286 $runtime.sendText(super._cookie, $value); 287 } 288 } 289 break; 290 case 4: 291 { 292 loc = $value; 293 $_ngcc_current_state = 3; 294 action0(); 295 } 296 break; 297 case 2: 298 { 299 if(($ai = $runtime.getAttributeIndex("","location"))>=0) { 300 $runtime.consumeAttribute($ai); 301 $runtime.sendText(super._cookie, $value); 302 } 303 else { 304 $_ngcc_current_state = 1; 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 }