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 importDecl extends NGCCHandler {
044: private String ns;
045: private String schemaLocation;
046: protected final NGCCRuntimeEx $runtime;
047: private int $_ngcc_current_state;
048: protected String $uri;
049: protected String $localName;
050: protected String $qname;
051:
052: public final NGCCRuntime getRuntime() {
053: return ($runtime);
054: }
055:
056: public importDecl(NGCCHandler parent, NGCCEventSource source,
057: NGCCRuntimeEx runtime, int cookie) {
058: super (source, parent, cookie);
059: $runtime = runtime;
060: $_ngcc_current_state = 12;
061: }
062:
063: public importDecl(NGCCRuntimeEx runtime) {
064: this (null, runtime, runtime, -1);
065: }
066:
067: private void action0() throws SAXException {
068:
069: if (ns == null)
070: ns = "";
071: $runtime.importSchema(ns, schemaLocation);
072:
073: }
074:
075: public void enterElement(String $__uri, String $__local,
076: String $__qname, Attributes $attrs) throws SAXException {
077: int $ai;
078: $uri = $__uri;
079: $localName = $__local;
080: $qname = $__qname;
081: switch ($_ngcc_current_state) {
082: case 4: {
083: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
084: $runtime.consumeAttribute($ai);
085: $runtime.sendEnterElement(super ._cookie, $__uri,
086: $__local, $__qname, $attrs);
087: } else {
088: $_ngcc_current_state = 2;
089: $runtime.sendEnterElement(super ._cookie, $__uri,
090: $__local, $__qname, $attrs);
091: }
092: }
093: break;
094: case 12: {
095: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
096: .equals("import"))) {
097: $runtime.onEnterElementConsumed($__uri, $__local,
098: $__qname, $attrs);
099: $_ngcc_current_state = 8;
100: } else {
101: unexpectedEnterElement($__qname);
102: }
103: }
104: break;
105: case 2: {
106: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
107: .equals("annotation"))) {
108: NGCCHandler h = new annotation(this , super ._source,
109: $runtime, 3, null, AnnotationContext.SCHEMA);
110: spawnChildFromEnterElement(h, $__uri, $__local,
111: $__qname, $attrs);
112: } else {
113: $_ngcc_current_state = 1;
114: $runtime.sendEnterElement(super ._cookie, $__uri,
115: $__local, $__qname, $attrs);
116: }
117: }
118: break;
119: case 0: {
120: revertToParentFromEnterElement(this , super ._cookie, $__uri,
121: $__local, $__qname, $attrs);
122: }
123: break;
124: case 8: {
125: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
126: $runtime.consumeAttribute($ai);
127: $runtime.sendEnterElement(super ._cookie, $__uri,
128: $__local, $__qname, $attrs);
129: } else {
130: $_ngcc_current_state = 4;
131: $runtime.sendEnterElement(super ._cookie, $__uri,
132: $__local, $__qname, $attrs);
133: }
134: }
135: break;
136: default: {
137: unexpectedEnterElement($__qname);
138: }
139: break;
140: }
141: }
142:
143: public void leaveElement(String $__uri, String $__local,
144: String $__qname) throws SAXException {
145: int $ai;
146: $uri = $__uri;
147: $localName = $__local;
148: $qname = $__qname;
149: switch ($_ngcc_current_state) {
150: case 4: {
151: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
152: $runtime.consumeAttribute($ai);
153: $runtime.sendLeaveElement(super ._cookie, $__uri,
154: $__local, $__qname);
155: } else {
156: $_ngcc_current_state = 2;
157: $runtime.sendLeaveElement(super ._cookie, $__uri,
158: $__local, $__qname);
159: }
160: }
161: break;
162: case 1: {
163: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
164: .equals("import"))) {
165: $runtime.onLeaveElementConsumed($__uri, $__local,
166: $__qname);
167: $_ngcc_current_state = 0;
168: action0();
169: } else {
170: unexpectedLeaveElement($__qname);
171: }
172: }
173: break;
174: case 2: {
175: $_ngcc_current_state = 1;
176: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
177: $__qname);
178: }
179: break;
180: case 0: {
181: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
182: $__local, $__qname);
183: }
184: break;
185: case 8: {
186: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
187: $runtime.consumeAttribute($ai);
188: $runtime.sendLeaveElement(super ._cookie, $__uri,
189: $__local, $__qname);
190: } else {
191: $_ngcc_current_state = 4;
192: $runtime.sendLeaveElement(super ._cookie, $__uri,
193: $__local, $__qname);
194: }
195: }
196: break;
197: default: {
198: unexpectedLeaveElement($__qname);
199: }
200: break;
201: }
202: }
203:
204: public void enterAttribute(String $__uri, String $__local,
205: String $__qname) throws SAXException {
206: int $ai;
207: $uri = $__uri;
208: $localName = $__local;
209: $qname = $__qname;
210: switch ($_ngcc_current_state) {
211: case 4: {
212: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
213: $_ngcc_current_state = 6;
214: } else {
215: $_ngcc_current_state = 2;
216: $runtime.sendEnterAttribute(super ._cookie, $__uri,
217: $__local, $__qname);
218: }
219: }
220: break;
221: case 2: {
222: $_ngcc_current_state = 1;
223: $runtime.sendEnterAttribute(super ._cookie, $__uri,
224: $__local, $__qname);
225: }
226: break;
227: case 0: {
228: revertToParentFromEnterAttribute(this , super ._cookie,
229: $__uri, $__local, $__qname);
230: }
231: break;
232: case 8: {
233: if (($__uri.equals("") && $__local.equals("namespace"))) {
234: $_ngcc_current_state = 10;
235: } else {
236: $_ngcc_current_state = 4;
237: $runtime.sendEnterAttribute(super ._cookie, $__uri,
238: $__local, $__qname);
239: }
240: }
241: break;
242: default: {
243: unexpectedEnterAttribute($__qname);
244: }
245: break;
246: }
247: }
248:
249: public void leaveAttribute(String $__uri, String $__local,
250: String $__qname) throws SAXException {
251: int $ai;
252: $uri = $__uri;
253: $localName = $__local;
254: $qname = $__qname;
255: switch ($_ngcc_current_state) {
256: case 4: {
257: $_ngcc_current_state = 2;
258: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
259: $__local, $__qname);
260: }
261: break;
262: case 5: {
263: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
264: $_ngcc_current_state = 2;
265: } else {
266: unexpectedLeaveAttribute($__qname);
267: }
268: }
269: break;
270: case 9: {
271: if (($__uri.equals("") && $__local.equals("namespace"))) {
272: $_ngcc_current_state = 4;
273: } else {
274: unexpectedLeaveAttribute($__qname);
275: }
276: }
277: break;
278: case 2: {
279: $_ngcc_current_state = 1;
280: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
281: $__local, $__qname);
282: }
283: break;
284: case 0: {
285: revertToParentFromLeaveAttribute(this , super ._cookie,
286: $__uri, $__local, $__qname);
287: }
288: break;
289: case 8: {
290: $_ngcc_current_state = 4;
291: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
292: $__local, $__qname);
293: }
294: break;
295: default: {
296: unexpectedLeaveAttribute($__qname);
297: }
298: break;
299: }
300: }
301:
302: public void text(String $value) throws SAXException {
303: int $ai;
304: switch ($_ngcc_current_state) {
305: case 4: {
306: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
307: $runtime.consumeAttribute($ai);
308: $runtime.sendText(super ._cookie, $value);
309: } else {
310: $_ngcc_current_state = 2;
311: $runtime.sendText(super ._cookie, $value);
312: }
313: }
314: break;
315: case 6: {
316: schemaLocation = $value;
317: $_ngcc_current_state = 5;
318: }
319: break;
320: case 2: {
321: $_ngcc_current_state = 1;
322: $runtime.sendText(super ._cookie, $value);
323: }
324: break;
325: case 0: {
326: revertToParentFromText(this , super ._cookie, $value);
327: }
328: break;
329: case 8: {
330: if (($ai = $runtime.getAttributeIndex("", "namespace")) >= 0) {
331: $runtime.consumeAttribute($ai);
332: $runtime.sendText(super ._cookie, $value);
333: } else {
334: $_ngcc_current_state = 4;
335: $runtime.sendText(super ._cookie, $value);
336: }
337: }
338: break;
339: case 10: {
340: ns = $value;
341: $_ngcc_current_state = 9;
342: }
343: break;
344: }
345: }
346:
347: public void onChildCompleted(Object $__result__, int $__cookie__,
348: boolean $__needAttCheck__) throws SAXException {
349: switch ($__cookie__) {
350: case 3: {
351: $_ngcc_current_state = 1;
352: }
353: break;
354: }
355: }
356:
357: public boolean accepted() {
358: return (($_ngcc_current_state == 0));
359: }
360:
361: }
|