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.tools.internal.jxc.gen.config;
28import org.xml.sax.SAXException;
29import org.xml.sax.XMLReader;
30import org.xml.sax.Attributes;
31import com.sun.tools.internal.jxc.NGCCRuntimeEx;
32
33import java.io.File;
34
35/**
36 * <p><b>
37 *     Auto-generated, do not edit.
38 * </b></p>
39 */
40public class Schema extends NGCCHandler {
41    private File baseDir;
42    private String loc;
43    protected final NGCCRuntimeEx $runtime;
44    private int $_ngcc_current_state;
45    protected String $uri;
46    protected String $localName;
47    protected String $qname;
48
49    public final NGCCRuntime getRuntime() {
50        return($runtime);
51    }
52
53    public Schema(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, File _baseDir) {
54        super(source, parent, cookie);
55        $runtime = runtime;
56        this.baseDir = _baseDir;
57        $_ngcc_current_state = 10;
58    }
59
60    public Schema(NGCCRuntimeEx runtime, File _baseDir) {
61        this(null, runtime, runtime, -1, _baseDir);
62    }
63
64    private void action0()throws SAXException {
65        location = new File(baseDir,loc);
66}
67
68    public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
69        int $ai;
70        $uri = $__uri;
71        $localName = $__local;
72        $qname = $__qname;
73        switch($_ngcc_current_state) {
74        case 0:
75            {
76                revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
77            }
78            break;
79        case 2:
80            {
81                if(($ai = $runtime.getAttributeIndex("","location"))>=0) {
82                    $runtime.consumeAttribute($ai);
83                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
84                }
85                else {
86                    $_ngcc_current_state = 1;
87                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
88                }
89            }
90            break;
91        case 6:
92            {
93                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
94                    $runtime.consumeAttribute($ai);
95                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
96                }
97                else {
98                    $_ngcc_current_state = 2;
99                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
100                }
101            }
102            break;
103        case 10:
104            {
105                if(($__uri.equals("") && $__local.equals("schema"))) {
106                    $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
107                    $_ngcc_current_state = 6;
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 1:
129            {
130                if(($__uri.equals("") && $__local.equals("schema"))) {
131                    $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
132                    $_ngcc_current_state = 0;
133                }
134                else {
135                    unexpectedLeaveElement($__qname);
136                }
137            }
138            break;
139        case 0:
140            {
141                revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
142            }
143            break;
144        case 2:
145            {
146                if(($ai = $runtime.getAttributeIndex("","location"))>=0) {
147                    $runtime.consumeAttribute($ai);
148                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
149                }
150                else {
151                    $_ngcc_current_state = 1;
152                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
153                }
154            }
155            break;
156        case 6:
157            {
158                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
159                    $runtime.consumeAttribute($ai);
160                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
161                }
162                else {
163                    $_ngcc_current_state = 2;
164                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
165                }
166            }
167            break;
168        default:
169            {
170                unexpectedLeaveElement($__qname);
171            }
172            break;
173        }
174    }
175
176    public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
177        int $ai;
178        $uri = $__uri;
179        $localName = $__local;
180        $qname = $__qname;
181        switch($_ngcc_current_state) {
182        case 0:
183            {
184                revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
185            }
186            break;
187        case 2:
188            {
189                if(($__uri.equals("") && $__local.equals("location"))) {
190                    $_ngcc_current_state = 4;
191                }
192                else {
193                    $_ngcc_current_state = 1;
194                    $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
195                }
196            }
197            break;
198        case 6:
199            {
200                if(($__uri.equals("") && $__local.equals("namespace"))) {
201                    $_ngcc_current_state = 8;
202                }
203                else {
204                    $_ngcc_current_state = 2;
205                    $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
206                }
207            }
208            break;
209        default:
210            {
211                unexpectedEnterAttribute($__qname);
212            }
213            break;
214        }
215    }
216
217    public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
218        int $ai;
219        $uri = $__uri;
220        $localName = $__local;
221        $qname = $__qname;
222        switch($_ngcc_current_state) {
223        case 0:
224            {
225                revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
226            }
227            break;
228        case 3:
229            {
230                if(($__uri.equals("") && $__local.equals("location"))) {
231                    $_ngcc_current_state = 1;
232                }
233                else {
234                    unexpectedLeaveAttribute($__qname);
235                }
236            }
237            break;
238        case 7:
239            {
240                if(($__uri.equals("") && $__local.equals("namespace"))) {
241                    $_ngcc_current_state = 2;
242                }
243                else {
244                    unexpectedLeaveAttribute($__qname);
245                }
246            }
247            break;
248        case 2:
249            {
250                $_ngcc_current_state = 1;
251                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
252            }
253            break;
254        case 6:
255            {
256                $_ngcc_current_state = 2;
257                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
258            }
259            break;
260        default:
261            {
262                unexpectedLeaveAttribute($__qname);
263            }
264            break;
265        }
266    }
267
268    public void text(String $value) throws SAXException {
269        int $ai;
270        switch($_ngcc_current_state) {
271        case 8:
272            {
273                namespace = $value;
274                $_ngcc_current_state = 7;
275            }
276            break;
277        case 4:
278            {
279                loc = $value;
280                $_ngcc_current_state = 3;
281                action0();
282            }
283            break;
284        case 0:
285            {
286                revertToParentFromText(this, super._cookie, $value);
287            }
288            break;
289        case 2:
290            {
291                if(($ai = $runtime.getAttributeIndex("","location"))>=0) {
292                    $runtime.consumeAttribute($ai);
293                    $runtime.sendText(super._cookie, $value);
294                }
295                else {
296                    $_ngcc_current_state = 1;
297                    $runtime.sendText(super._cookie, $value);
298                }
299            }
300            break;
301        case 6:
302            {
303                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
304                    $runtime.consumeAttribute($ai);
305                    $runtime.sendText(super._cookie, $value);
306                }
307                else {
308                    $_ngcc_current_state = 2;
309                    $runtime.sendText(super._cookie, $value);
310                }
311            }
312            break;
313        }
314    }
315
316    public void onChildCompleted(Object result, int cookie, boolean needAttCheck)throws SAXException {
317        switch(cookie) {
318        }
319    }
320
321    public boolean accepted() {
322        return(($_ngcc_current_state == 0));
323    }
324
325
326       private File location;
327       private String namespace;
328       public String getNamespace() { return this.namespace;}
329       public File getLocation() { return this.location;}
330
331}
332