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.xml.internal.xsom.impl.parser.state;
28import org.xml.sax.SAXException;
29import org.xml.sax.XMLReader;
30import org.xml.sax.Attributes;
31import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
32
33    import com.sun.xml.internal.xsom.*;
34    import com.sun.xml.internal.xsom.parser.*;
35    import com.sun.xml.internal.xsom.impl.*;
36    import com.sun.xml.internal.xsom.impl.parser.*;
37    import org.xml.sax.Locator;
38    import org.xml.sax.ContentHandler;
39    import org.xml.sax.helpers.*;
40    import java.util.*;
41    import java.math.BigInteger;
42
43
44
45class importDecl extends NGCCHandler {
46    private String ns;
47    private String schemaLocation;
48    protected final NGCCRuntimeEx $runtime;
49    private int $_ngcc_current_state;
50    protected String $uri;
51    protected String $localName;
52    protected String $qname;
53
54    public final NGCCRuntime getRuntime() {
55        return($runtime);
56    }
57
58    public importDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
59        super(source, parent, cookie);
60        $runtime = runtime;
61        $_ngcc_current_state = 12;
62    }
63
64    public importDecl(NGCCRuntimeEx runtime) {
65        this(null, runtime, runtime, -1);
66    }
67
68    private void action0()throws SAXException {
69
70                        if(ns==null)    ns="";
71        $runtime.importSchema( ns,schemaLocation );
72
73}
74
75    public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
76        int $ai;
77        $uri = $__uri;
78        $localName = $__local;
79        $qname = $__qname;
80        switch($_ngcc_current_state) {
81        case 4:
82            {
83                if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
84                    $runtime.consumeAttribute($ai);
85                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
86                }
87                else {
88                    $_ngcc_current_state = 2;
89                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
90                }
91            }
92            break;
93        case 8:
94            {
95                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
96                    $runtime.consumeAttribute($ai);
97                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
98                }
99                else {
100                    $_ngcc_current_state = 4;
101                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
102                }
103            }
104            break;
105        case 12:
106            {
107                if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("import"))) {
108                    $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
109                    $_ngcc_current_state = 8;
110                }
111                else {
112                    unexpectedEnterElement($__qname);
113                }
114            }
115            break;
116        case 2:
117            {
118                if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
119                    NGCCHandler h = new annotation(this, super._source, $runtime, 340, null,AnnotationContext.SCHEMA);
120                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
121                }
122                else {
123                    $_ngcc_current_state = 1;
124                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
125                }
126            }
127            break;
128        case 0:
129            {
130                revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
131            }
132            break;
133        default:
134            {
135                unexpectedEnterElement($__qname);
136            }
137            break;
138        }
139    }
140
141    public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
142        int $ai;
143        $uri = $__uri;
144        $localName = $__local;
145        $qname = $__qname;
146        switch($_ngcc_current_state) {
147        case 4:
148            {
149                if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
150                    $runtime.consumeAttribute($ai);
151                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
152                }
153                else {
154                    $_ngcc_current_state = 2;
155                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
156                }
157            }
158            break;
159        case 8:
160            {
161                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
162                    $runtime.consumeAttribute($ai);
163                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
164                }
165                else {
166                    $_ngcc_current_state = 4;
167                    $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
168                }
169            }
170            break;
171        case 2:
172            {
173                $_ngcc_current_state = 1;
174                $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
175            }
176            break;
177        case 1:
178            {
179                if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("import"))) {
180                    $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
181                    $_ngcc_current_state = 0;
182                    action0();
183                }
184                else {
185                    unexpectedLeaveElement($__qname);
186                }
187            }
188            break;
189        case 0:
190            {
191                revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
192            }
193            break;
194        default:
195            {
196                unexpectedLeaveElement($__qname);
197            }
198            break;
199        }
200    }
201
202    public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
203        int $ai;
204        $uri = $__uri;
205        $localName = $__local;
206        $qname = $__qname;
207        switch($_ngcc_current_state) {
208        case 4:
209            {
210                if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
211                    $_ngcc_current_state = 6;
212                }
213                else {
214                    $_ngcc_current_state = 2;
215                    $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
216                }
217            }
218            break;
219        case 8:
220            {
221                if(($__uri.equals("") && $__local.equals("namespace"))) {
222                    $_ngcc_current_state = 10;
223                }
224                else {
225                    $_ngcc_current_state = 4;
226                    $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
227                }
228            }
229            break;
230        case 2:
231            {
232                $_ngcc_current_state = 1;
233                $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
234            }
235            break;
236        case 0:
237            {
238                revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
239            }
240            break;
241        default:
242            {
243                unexpectedEnterAttribute($__qname);
244            }
245            break;
246        }
247    }
248
249    public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
250        int $ai;
251        $uri = $__uri;
252        $localName = $__local;
253        $qname = $__qname;
254        switch($_ngcc_current_state) {
255        case 9:
256            {
257                if(($__uri.equals("") && $__local.equals("namespace"))) {
258                    $_ngcc_current_state = 4;
259                }
260                else {
261                    unexpectedLeaveAttribute($__qname);
262                }
263            }
264            break;
265        case 4:
266            {
267                $_ngcc_current_state = 2;
268                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
269            }
270            break;
271        case 8:
272            {
273                $_ngcc_current_state = 4;
274                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
275            }
276            break;
277        case 5:
278            {
279                if(($__uri.equals("") && $__local.equals("schemaLocation"))) {
280                    $_ngcc_current_state = 2;
281                }
282                else {
283                    unexpectedLeaveAttribute($__qname);
284                }
285            }
286            break;
287        case 2:
288            {
289                $_ngcc_current_state = 1;
290                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
291            }
292            break;
293        case 0:
294            {
295                revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
296            }
297            break;
298        default:
299            {
300                unexpectedLeaveAttribute($__qname);
301            }
302            break;
303        }
304    }
305
306    public void text(String $value) throws SAXException {
307        int $ai;
308        switch($_ngcc_current_state) {
309        case 4:
310            {
311                if(($ai = $runtime.getAttributeIndex("","schemaLocation"))>=0) {
312                    $runtime.consumeAttribute($ai);
313                    $runtime.sendText(super._cookie, $value);
314                }
315                else {
316                    $_ngcc_current_state = 2;
317                    $runtime.sendText(super._cookie, $value);
318                }
319            }
320            break;
321        case 8:
322            {
323                if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) {
324                    $runtime.consumeAttribute($ai);
325                    $runtime.sendText(super._cookie, $value);
326                }
327                else {
328                    $_ngcc_current_state = 4;
329                    $runtime.sendText(super._cookie, $value);
330                }
331            }
332            break;
333        case 10:
334            {
335                ns = $value;
336                $_ngcc_current_state = 9;
337            }
338            break;
339        case 2:
340            {
341                $_ngcc_current_state = 1;
342                $runtime.sendText(super._cookie, $value);
343            }
344            break;
345        case 0:
346            {
347                revertToParentFromText(this, super._cookie, $value);
348            }
349            break;
350        case 6:
351            {
352                schemaLocation = $value;
353                $_ngcc_current_state = 5;
354            }
355            break;
356        }
357    }
358
359    public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
360        switch($__cookie__) {
361        case 340:
362            {
363                $_ngcc_current_state = 1;
364            }
365            break;
366        }
367    }
368
369    public boolean accepted() {
370        return(($_ngcc_current_state == 0));
371    }
372
373
374}
375