001: /* this file is generated by RelaxNGCC */
002: package com.sun.xml.xsom.impl.parser.state;
003:
004: import org.xml.sax.SAXException;
005: import org.xml.sax.XMLReader;
006: import org.xml.sax.Attributes;
007: import com.sun.xml.xsom.impl.parser.NGCCRuntimeEx;
008:
009: import com.sun.xml.xsom.*;
010: import com.sun.xml.xsom.parser.*;
011: import com.sun.xml.xsom.impl.*;
012: import com.sun.xml.xsom.impl.parser.*;
013: import org.xml.sax.Locator;
014: import org.xml.sax.ContentHandler;
015: import org.xml.sax.helpers.*;
016: import java.util.*;
017:
018: class xpath extends NGCCHandler {
019: private String xpath;
020: private ForeignAttributesImpl fa;
021: private AnnotationImpl ann;
022: protected final NGCCRuntimeEx $runtime;
023: private int $_ngcc_current_state;
024: protected String $uri;
025: protected String $localName;
026: protected String $qname;
027:
028: public final NGCCRuntime getRuntime() {
029: return ($runtime);
030: }
031:
032: public xpath(NGCCHandler parent, NGCCEventSource source,
033: NGCCRuntimeEx runtime, int cookie) {
034: super (source, parent, cookie);
035: $runtime = runtime;
036: $_ngcc_current_state = 6;
037: }
038:
039: public xpath(NGCCRuntimeEx runtime) {
040: this (null, runtime, runtime, -1);
041: }
042:
043: public void enterElement(String $__uri, String $__local,
044: String $__qname, Attributes $attrs) throws SAXException {
045: int $ai;
046: $uri = $__uri;
047: $localName = $__local;
048: $qname = $__qname;
049: switch ($_ngcc_current_state) {
050: case 5: {
051: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
052: $runtime.consumeAttribute($ai);
053: $runtime.sendEnterElement(super ._cookie, $__uri,
054: $__local, $__qname, $attrs);
055: } else {
056: unexpectedEnterElement($__qname);
057: }
058: }
059: break;
060: case 1: {
061: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
062: .equals("annotation"))) {
063: NGCCHandler h = new annotation(this , super ._source,
064: $runtime, 158, null, AnnotationContext.XPATH);
065: spawnChildFromEnterElement(h, $__uri, $__local,
066: $__qname, $attrs);
067: } else {
068: $_ngcc_current_state = 0;
069: $runtime.sendEnterElement(super ._cookie, $__uri,
070: $__local, $__qname, $attrs);
071: }
072: }
073: break;
074: case 0: {
075: revertToParentFromEnterElement(makeResult(), super ._cookie,
076: $__uri, $__local, $__qname, $attrs);
077: }
078: break;
079: case 6: {
080: if ((($ai = $runtime.getAttributeIndex("", "xpath")) >= 0 && ($__uri
081: .equals("http://www.w3.org/2001/XMLSchema") && $__local
082: .equals("annotation")))) {
083: NGCCHandler h = new foreignAttributes(this ,
084: super ._source, $runtime, 163, null);
085: spawnChildFromEnterElement(h, $__uri, $__local,
086: $__qname, $attrs);
087: } else {
088: unexpectedEnterElement($__qname);
089: }
090: }
091: break;
092: default: {
093: unexpectedEnterElement($__qname);
094: }
095: break;
096: }
097: }
098:
099: public void leaveElement(String $__uri, String $__local,
100: String $__qname) throws SAXException {
101: int $ai;
102: $uri = $__uri;
103: $localName = $__local;
104: $qname = $__qname;
105: switch ($_ngcc_current_state) {
106: case 5: {
107: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
108: $runtime.consumeAttribute($ai);
109: $runtime.sendLeaveElement(super ._cookie, $__uri,
110: $__local, $__qname);
111: } else {
112: unexpectedLeaveElement($__qname);
113: }
114: }
115: break;
116: case 1: {
117: $_ngcc_current_state = 0;
118: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
119: $__qname);
120: }
121: break;
122: case 0: {
123: revertToParentFromLeaveElement(makeResult(), super ._cookie,
124: $__uri, $__local, $__qname);
125: }
126: break;
127: case 6: {
128: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
129: NGCCHandler h = new foreignAttributes(this ,
130: super ._source, $runtime, 163, null);
131: spawnChildFromLeaveElement(h, $__uri, $__local,
132: $__qname);
133: } else {
134: unexpectedLeaveElement($__qname);
135: }
136: }
137: break;
138: default: {
139: unexpectedLeaveElement($__qname);
140: }
141: break;
142: }
143: }
144:
145: public void enterAttribute(String $__uri, String $__local,
146: String $__qname) throws SAXException {
147: int $ai;
148: $uri = $__uri;
149: $localName = $__local;
150: $qname = $__qname;
151: switch ($_ngcc_current_state) {
152: case 5: {
153: if (($__uri.equals("") && $__local.equals("xpath"))) {
154: $_ngcc_current_state = 4;
155: } else {
156: unexpectedEnterAttribute($__qname);
157: }
158: }
159: break;
160: case 1: {
161: $_ngcc_current_state = 0;
162: $runtime.sendEnterAttribute(super ._cookie, $__uri,
163: $__local, $__qname);
164: }
165: break;
166: case 0: {
167: revertToParentFromEnterAttribute(makeResult(),
168: super ._cookie, $__uri, $__local, $__qname);
169: }
170: break;
171: case 6: {
172: if (($__uri.equals("") && $__local.equals("xpath"))) {
173: NGCCHandler h = new foreignAttributes(this ,
174: super ._source, $runtime, 163, null);
175: spawnChildFromEnterAttribute(h, $__uri, $__local,
176: $__qname);
177: } else {
178: unexpectedEnterAttribute($__qname);
179: }
180: }
181: break;
182: default: {
183: unexpectedEnterAttribute($__qname);
184: }
185: break;
186: }
187: }
188:
189: public void leaveAttribute(String $__uri, String $__local,
190: String $__qname) throws SAXException {
191: int $ai;
192: $uri = $__uri;
193: $localName = $__local;
194: $qname = $__qname;
195: switch ($_ngcc_current_state) {
196: case 1: {
197: $_ngcc_current_state = 0;
198: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
199: $__local, $__qname);
200: }
201: break;
202: case 0: {
203: revertToParentFromLeaveAttribute(makeResult(),
204: super ._cookie, $__uri, $__local, $__qname);
205: }
206: break;
207: case 3: {
208: if (($__uri.equals("") && $__local.equals("xpath"))) {
209: $_ngcc_current_state = 1;
210: } else {
211: unexpectedLeaveAttribute($__qname);
212: }
213: }
214: break;
215: default: {
216: unexpectedLeaveAttribute($__qname);
217: }
218: break;
219: }
220: }
221:
222: public void text(String $value) throws SAXException {
223: int $ai;
224: switch ($_ngcc_current_state) {
225: case 5: {
226: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
227: $runtime.consumeAttribute($ai);
228: $runtime.sendText(super ._cookie, $value);
229: }
230: }
231: break;
232: case 1: {
233: $_ngcc_current_state = 0;
234: $runtime.sendText(super ._cookie, $value);
235: }
236: break;
237: case 4: {
238: xpath = $value;
239: $_ngcc_current_state = 3;
240: }
241: break;
242: case 0: {
243: revertToParentFromText(makeResult(), super ._cookie, $value);
244: }
245: break;
246: case 6: {
247: if (($ai = $runtime.getAttributeIndex("", "xpath")) >= 0) {
248: NGCCHandler h = new foreignAttributes(this ,
249: super ._source, $runtime, 163, null);
250: spawnChildFromText(h, $value);
251: }
252: }
253: break;
254: }
255: }
256:
257: public void onChildCompleted(Object $__result__, int $__cookie__,
258: boolean $__needAttCheck__) throws SAXException {
259: switch ($__cookie__) {
260: case 158: {
261: ann = ((AnnotationImpl) $__result__);
262: $_ngcc_current_state = 0;
263: }
264: break;
265: case 163: {
266: fa = ((ForeignAttributesImpl) $__result__);
267: $_ngcc_current_state = 5;
268: }
269: break;
270: }
271: }
272:
273: public boolean accepted() {
274: return ((($_ngcc_current_state == 0) || ($_ngcc_current_state == 1)));
275: }
276:
277: private XPathImpl makeResult() {
278: return new XPathImpl($runtime.document, ann, $runtime
279: .copyLocator(), fa, $runtime.createXmlString(xpath));
280: }
281:
282: }
|