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 includeDecl extends NGCCHandler {
044: private String schemaLocation;
045: protected final NGCCRuntimeEx $runtime;
046: private int $_ngcc_current_state;
047: protected String $uri;
048: protected String $localName;
049: protected String $qname;
050:
051: public final NGCCRuntime getRuntime() {
052: return ($runtime);
053: }
054:
055: public includeDecl(NGCCHandler parent, NGCCEventSource source,
056: NGCCRuntimeEx runtime, int cookie) {
057: super (source, parent, cookie);
058: $runtime = runtime;
059: $_ngcc_current_state = 7;
060: }
061:
062: public includeDecl(NGCCRuntimeEx runtime) {
063: this (null, runtime, runtime, -1);
064: }
065:
066: private void action0() throws SAXException {
067: $runtime.includeSchema(schemaLocation);
068: }
069:
070: public void enterElement(String $__uri, String $__local,
071: String $__qname, Attributes $attrs) throws SAXException {
072: int $ai;
073: $uri = $__uri;
074: $localName = $__local;
075: $qname = $__qname;
076: switch ($_ngcc_current_state) {
077: case 0: {
078: revertToParentFromEnterElement(this , super ._cookie, $__uri,
079: $__local, $__qname, $attrs);
080: }
081: break;
082: case 7: {
083: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
084: .equals("include"))) {
085: $runtime.onEnterElementConsumed($__uri, $__local,
086: $__qname, $attrs);
087: $_ngcc_current_state = 6;
088: } else {
089: unexpectedEnterElement($__qname);
090: }
091: }
092: break;
093: case 2: {
094: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
095: .equals("annotation"))) {
096: NGCCHandler h = new annotation(this , super ._source,
097: $runtime, 231, null, AnnotationContext.SCHEMA);
098: spawnChildFromEnterElement(h, $__uri, $__local,
099: $__qname, $attrs);
100: } else {
101: $_ngcc_current_state = 1;
102: $runtime.sendEnterElement(super ._cookie, $__uri,
103: $__local, $__qname, $attrs);
104: }
105: }
106: break;
107: case 6: {
108: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
109: $runtime.consumeAttribute($ai);
110: $runtime.sendEnterElement(super ._cookie, $__uri,
111: $__local, $__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 0: {
132: revertToParentFromLeaveElement(this , super ._cookie, $__uri,
133: $__local, $__qname);
134: }
135: break;
136: case 2: {
137: $_ngcc_current_state = 1;
138: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
139: $__qname);
140: }
141: break;
142: case 6: {
143: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
144: $runtime.consumeAttribute($ai);
145: $runtime.sendLeaveElement(super ._cookie, $__uri,
146: $__local, $__qname);
147: } else {
148: unexpectedLeaveElement($__qname);
149: }
150: }
151: break;
152: case 1: {
153: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
154: .equals("include"))) {
155: $runtime.onLeaveElementConsumed($__uri, $__local,
156: $__qname);
157: $_ngcc_current_state = 0;
158: action0();
159: } else {
160: unexpectedLeaveElement($__qname);
161: }
162: }
163: break;
164: default: {
165: unexpectedLeaveElement($__qname);
166: }
167: break;
168: }
169: }
170:
171: public void enterAttribute(String $__uri, String $__local,
172: String $__qname) throws SAXException {
173: int $ai;
174: $uri = $__uri;
175: $localName = $__local;
176: $qname = $__qname;
177: switch ($_ngcc_current_state) {
178: case 0: {
179: revertToParentFromEnterAttribute(this , super ._cookie,
180: $__uri, $__local, $__qname);
181: }
182: break;
183: case 2: {
184: $_ngcc_current_state = 1;
185: $runtime.sendEnterAttribute(super ._cookie, $__uri,
186: $__local, $__qname);
187: }
188: break;
189: case 6: {
190: if (($__uri.equals("") && $__local.equals("schemaLocation"))) {
191: $_ngcc_current_state = 5;
192: } else {
193: unexpectedEnterAttribute($__qname);
194: }
195: }
196: break;
197: default: {
198: unexpectedEnterAttribute($__qname);
199: }
200: break;
201: }
202: }
203:
204: public void leaveAttribute(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 = 2;
214: } else {
215: unexpectedLeaveAttribute($__qname);
216: }
217: }
218: break;
219: case 0: {
220: revertToParentFromLeaveAttribute(this , super ._cookie,
221: $__uri, $__local, $__qname);
222: }
223: break;
224: case 2: {
225: $_ngcc_current_state = 1;
226: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
227: $__local, $__qname);
228: }
229: break;
230: default: {
231: unexpectedLeaveAttribute($__qname);
232: }
233: break;
234: }
235: }
236:
237: public void text(String $value) throws SAXException {
238: int $ai;
239: switch ($_ngcc_current_state) {
240: case 0: {
241: revertToParentFromText(this , super ._cookie, $value);
242: }
243: break;
244: case 2: {
245: $_ngcc_current_state = 1;
246: $runtime.sendText(super ._cookie, $value);
247: }
248: break;
249: case 5: {
250: schemaLocation = $value;
251: $_ngcc_current_state = 4;
252: }
253: break;
254: case 6: {
255: if (($ai = $runtime.getAttributeIndex("", "schemaLocation")) >= 0) {
256: $runtime.consumeAttribute($ai);
257: $runtime.sendText(super ._cookie, $value);
258: }
259: }
260: break;
261: }
262: }
263:
264: public void onChildCompleted(Object $__result__, int $__cookie__,
265: boolean $__needAttCheck__) throws SAXException {
266: switch ($__cookie__) {
267: case 231: {
268: $_ngcc_current_state = 1;
269: }
270: break;
271: }
272: }
273:
274: public boolean accepted() {
275: return (($_ngcc_current_state == 0));
276: }
277:
278: }
|