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