1/* 2 * Copyright (c) 1997, 2013, 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 */ 27package com.sun.xml.internal.xsom.impl.parser.state; 28import org.xml.sax.SAXException; 29import org.xml.sax.XMLReader; 30import org.xml.sax.Attributes; 31import 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 45class 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 0: 76 { 77 revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs); 78 } 79 break; 80 case 6: 81 { 82 if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) { 83 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 77, null); 84 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 85 } 86 else { 87 unexpectedEnterElement($__qname); 88 } 89 } 90 break; 91 case 1: 92 { 93 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { 94 NGCCHandler h = new annotation(this, super._source, $runtime, 72, null,AnnotationContext.XPATH); 95 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); 96 } 97 else { 98 $_ngcc_current_state = 0; 99 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 100 } 101 } 102 break; 103 case 5: 104 { 105 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) { 106 $runtime.consumeAttribute($ai); 107 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); 108 } 109 else { 110 unexpectedEnterElement($__qname); 111 } 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 0: 129 { 130 revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname); 131 } 132 break; 133 case 6: 134 { 135 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) { 136 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 77, null); 137 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); 138 } 139 else { 140 unexpectedLeaveElement($__qname); 141 } 142 } 143 break; 144 case 1: 145 { 146 $_ngcc_current_state = 0; 147 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 148 } 149 break; 150 case 5: 151 { 152 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) { 153 $runtime.consumeAttribute($ai); 154 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); 155 } 156 else { 157 unexpectedLeaveElement($__qname); 158 } 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 0: 176 { 177 revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); 178 } 179 break; 180 case 6: 181 { 182 if(($__uri.equals("") && $__local.equals("xpath"))) { 183 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 77, null); 184 spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); 185 } 186 else { 187 unexpectedEnterAttribute($__qname); 188 } 189 } 190 break; 191 case 1: 192 { 193 $_ngcc_current_state = 0; 194 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); 195 } 196 break; 197 case 5: 198 { 199 if(($__uri.equals("") && $__local.equals("xpath"))) { 200 $_ngcc_current_state = 4; 201 } 202 else { 203 unexpectedEnterAttribute($__qname); 204 } 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 0: 222 { 223 revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); 224 } 225 break; 226 case 1: 227 { 228 $_ngcc_current_state = 0; 229 $runtime.sendLeaveAttribute(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 4: 254 { 255 xpath = $value; 256 $_ngcc_current_state = 3; 257 } 258 break; 259 case 0: 260 { 261 revertToParentFromText(makeResult(), super._cookie, $value); 262 } 263 break; 264 case 6: 265 { 266 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) { 267 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 77, null); 268 spawnChildFromText(h, $value); 269 } 270 } 271 break; 272 case 1: 273 { 274 $_ngcc_current_state = 0; 275 $runtime.sendText(super._cookie, $value); 276 } 277 break; 278 case 5: 279 { 280 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) { 281 $runtime.consumeAttribute($ai); 282 $runtime.sendText(super._cookie, $value); 283 } 284 } 285 break; 286 } 287 } 288 289 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { 290 switch($__cookie__) { 291 case 77: 292 { 293 fa = ((ForeignAttributesImpl)$__result__); 294 $_ngcc_current_state = 5; 295 } 296 break; 297 case 72: 298 { 299 ann = ((AnnotationImpl)$__result__); 300 $_ngcc_current_state = 0; 301 } 302 break; 303 } 304 } 305 306 public boolean accepted() { 307 return((($_ngcc_current_state == 1) || ($_ngcc_current_state == 0))); 308 } 309 310 311 private XPathImpl makeResult() { 312 return new XPathImpl($runtime.document,ann,$runtime.copyLocator(),fa, 313 $runtime.createXmlString(xpath)); 314 } 315 316} 317