001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: /* this file is generated by RelaxNGCC */
027: package com.sun.xml.internal.xsom.impl.parser.state;
028:
029: import org.xml.sax.SAXException;
030: import org.xml.sax.XMLReader;
031: import org.xml.sax.Attributes;
032: import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
033:
034: import com.sun.xml.internal.xsom.*;
035: import com.sun.xml.internal.xsom.parser.*;
036: import com.sun.xml.internal.xsom.impl.*;
037: import com.sun.xml.internal.xsom.impl.parser.*;
038: import org.xml.sax.Locator;
039: import org.xml.sax.ContentHandler;
040: import org.xml.sax.helpers.*;
041: import java.util.*;
042:
043: class xpath extends NGCCHandler {
044: private String xpath;
045: private ForeignAttributesImpl fa;
046: private AnnotationImpl ann;
047: protected final NGCCRuntimeEx $runtime;
048: private int $_ngcc_current_state;
049: protected String $uri;
050: protected String $localName;
051: protected String $qname;
052:
053: public final NGCCRuntime getRuntime() {
054: return ($runtime);
055: }
056:
057: public xpath(NGCCHandler parent, NGCCEventSource source,
058: NGCCRuntimeEx runtime, int cookie) {
059: super (source, parent, cookie);
060: $runtime = runtime;
061: $_ngcc_current_state = 6;
062: }
063:
064: public xpath(NGCCRuntimeEx runtime) {
065: this (null, runtime, runtime, -1);
066: }
067:
068: public void enterElement(String $__uri, String $__local,
069: String $__qname, Attributes $attrs) throws SAXException {
070: int $ai;
071: $uri = $__uri;
072: $localName = $__local;
073: $qname = $__qname;
074: switch ($_ngcc_current_state) {
075: case 1: {
076: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
077: .equals("annotation"))) {
078: NGCCHandler h = new annotation(this , super ._source,
079: $runtime, 66, null, AnnotationContext.XPATH);
080: spawnChildFromEnterElement(h, $__uri, $__local,
081: $__qname, $attrs);
082: } else {
083: $_ngcc_current_state = 0;
084: $runtime.sendEnterElement(super ._cookie, $__uri,
085: $__local, $__qname, $attrs);
086: }
087: }
088: break;
089: case 5: {
090: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
091: $runtime.consumeAttribute($ai);
092: $runtime.sendEnterElement(super ._cookie, $__uri,
093: $__local, $__qname, $attrs);
094: } else {
095: unexpectedEnterElement($__qname);
096: }
097: }
098: break;
099: case 0: {
100: revertToParentFromEnterElement(makeResult(), super ._cookie,
101: $__uri, $__local, $__qname, $attrs);
102: }
103: break;
104: case 6: {
105: if ((($ai = $runtime.getAttributeIndex("", "xpath")) >= 0 && ($__uri
106: .equals("http://www.w3.org/2001/XMLSchema") && $__local
107: .equals("annotation")))) {
108: NGCCHandler h = new foreignAttributes(this ,
109: super ._source, $runtime, 71, null);
110: spawnChildFromEnterElement(h, $__uri, $__local,
111: $__qname, $attrs);
112: } else {
113: unexpectedEnterElement($__qname);
114: }
115: }
116: break;
117: default: {
118: unexpectedEnterElement($__qname);
119: }
120: break;
121: }
122: }
123:
124: public void leaveElement(String $__uri, String $__local,
125: String $__qname) throws SAXException {
126: int $ai;
127: $uri = $__uri;
128: $localName = $__local;
129: $qname = $__qname;
130: switch ($_ngcc_current_state) {
131: case 1: {
132: $_ngcc_current_state = 0;
133: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
134: $__qname);
135: }
136: break;
137: case 5: {
138: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
139: $runtime.consumeAttribute($ai);
140: $runtime.sendLeaveElement(super ._cookie, $__uri,
141: $__local, $__qname);
142: } else {
143: unexpectedLeaveElement($__qname);
144: }
145: }
146: break;
147: case 0: {
148: revertToParentFromLeaveElement(makeResult(), super ._cookie,
149: $__uri, $__local, $__qname);
150: }
151: break;
152: case 6: {
153: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
154: NGCCHandler h = new foreignAttributes(this ,
155: super ._source, $runtime, 71, null);
156: spawnChildFromLeaveElement(h, $__uri, $__local,
157: $__qname);
158: } else {
159: unexpectedLeaveElement($__qname);
160: }
161: }
162: break;
163: default: {
164: unexpectedLeaveElement($__qname);
165: }
166: break;
167: }
168: }
169:
170: public void enterAttribute(String $__uri, String $__local,
171: String $__qname) throws SAXException {
172: int $ai;
173: $uri = $__uri;
174: $localName = $__local;
175: $qname = $__qname;
176: switch ($_ngcc_current_state) {
177: case 1: {
178: $_ngcc_current_state = 0;
179: $runtime.sendEnterAttribute(super ._cookie, $__uri,
180: $__local, $__qname);
181: }
182: break;
183: case 5: {
184: if (($__uri.equals("") && $__local.equals("xpath"))) {
185: $_ngcc_current_state = 4;
186: } else {
187: unexpectedEnterAttribute($__qname);
188: }
189: }
190: break;
191: case 0: {
192: revertToParentFromEnterAttribute(makeResult(),
193: super ._cookie, $__uri, $__local, $__qname);
194: }
195: break;
196: case 6: {
197: if (($__uri.equals("") && $__local.equals("xpath"))) {
198: NGCCHandler h = new foreignAttributes(this ,
199: super ._source, $runtime, 71, null);
200: spawnChildFromEnterAttribute(h, $__uri, $__local,
201: $__qname);
202: } else {
203: unexpectedEnterAttribute($__qname);
204: }
205: }
206: break;
207: default: {
208: unexpectedEnterAttribute($__qname);
209: }
210: break;
211: }
212: }
213:
214: public void leaveAttribute(String $__uri, String $__local,
215: 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: $_ngcc_current_state = 0;
223: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
224: $__local, $__qname);
225: }
226: break;
227: case 0: {
228: revertToParentFromLeaveAttribute(makeResult(),
229: super ._cookie, $__uri, $__local, $__qname);
230: }
231: break;
232: case 3: {
233: if (($__uri.equals("") && $__local.equals("xpath"))) {
234: $_ngcc_current_state = 1;
235: } else {
236: unexpectedLeaveAttribute($__qname);
237: }
238: }
239: break;
240: default: {
241: unexpectedLeaveAttribute($__qname);
242: }
243: break;
244: }
245: }
246:
247: public void text(String $value) throws SAXException {
248: int $ai;
249: switch ($_ngcc_current_state) {
250: case 1: {
251: $_ngcc_current_state = 0;
252: $runtime.sendText(super ._cookie, $value);
253: }
254: break;
255: case 4: {
256: xpath = $value;
257: $_ngcc_current_state = 3;
258: }
259: break;
260: case 5: {
261: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
262: $runtime.consumeAttribute($ai);
263: $runtime.sendText(super ._cookie, $value);
264: }
265: }
266: break;
267: case 0: {
268: revertToParentFromText(makeResult(), super ._cookie, $value);
269: }
270: break;
271: case 6: {
272: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
273: NGCCHandler h = new foreignAttributes(this ,
274: super ._source, $runtime, 71, null);
275: spawnChildFromText(h, $value);
276: }
277: }
278: break;
279: }
280: }
281:
282: public void onChildCompleted(Object $__result__, int $__cookie__,
283: boolean $__needAttCheck__) throws SAXException {
284: switch ($__cookie__) {
285: case 66: {
286: ann = ((AnnotationImpl) $__result__);
287: $_ngcc_current_state = 0;
288: }
289: break;
290: case 71: {
291: fa = ((ForeignAttributesImpl) $__result__);
292: $_ngcc_current_state = 5;
293: }
294: break;
295: }
296: }
297:
298: public boolean accepted() {
299: return ((($_ngcc_current_state == 0) || ($_ngcc_current_state == 1)));
300: }
301:
302: private XPathImpl makeResult() {
303: return new XPathImpl($runtime.document, ann, $runtime
304: .copyLocator(), fa, $runtime.createXmlString(xpath));
305: }
306:
307: }
|