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: import com.sun.xml.internal.xsom.parser.AnnotationParser;
044:
045: class annotation extends NGCCHandler {
046: private AnnotationContext context;
047: private AnnotationImpl existing;
048: protected final NGCCRuntimeEx $runtime;
049: private int $_ngcc_current_state;
050: protected String $uri;
051: protected String $localName;
052: protected String $qname;
053:
054: public final NGCCRuntime getRuntime() {
055: return ($runtime);
056: }
057:
058: public annotation(NGCCHandler parent, NGCCEventSource source,
059: NGCCRuntimeEx runtime, int cookie,
060: AnnotationImpl _existing, AnnotationContext _context) {
061: super (source, parent, cookie);
062: $runtime = runtime;
063: this .existing = _existing;
064: this .context = _context;
065: $_ngcc_current_state = 2;
066: }
067:
068: public annotation(NGCCRuntimeEx runtime, AnnotationImpl _existing,
069: AnnotationContext _context) {
070: this (null, runtime, runtime, -1, _existing, _context);
071: }
072:
073: private void action0() throws SAXException {
074:
075: locator = $runtime.copyLocator();
076: parser = $runtime.createAnnotationParser();
077: $runtime
078: .redirectSubtree(parser.getContentHandler(context,
079: $runtime.getAnnotationContextElementName(),
080: $runtime.getErrorHandler(), $runtime.parser
081: .getEntityResolver()), $uri,
082: $localName, $qname);
083:
084: }
085:
086: public void enterElement(String $__uri, String $__local,
087: String $__qname, Attributes $attrs) throws SAXException {
088: int $ai;
089: $uri = $__uri;
090: $localName = $__local;
091: $qname = $__qname;
092: switch ($_ngcc_current_state) {
093: case 0: {
094: revertToParentFromEnterElement(makeResult(), super ._cookie,
095: $__uri, $__local, $__qname, $attrs);
096: }
097: break;
098: case 2: {
099: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
100: .equals("annotation"))) {
101: $runtime.onEnterElementConsumed($__uri, $__local,
102: $__qname, $attrs);
103: action0();
104: $_ngcc_current_state = 1;
105: } else {
106: unexpectedEnterElement($__qname);
107: }
108: }
109: break;
110: default: {
111: unexpectedEnterElement($__qname);
112: }
113: break;
114: }
115: }
116:
117: public void leaveElement(String $__uri, String $__local,
118: String $__qname) throws SAXException {
119: int $ai;
120: $uri = $__uri;
121: $localName = $__local;
122: $qname = $__qname;
123: switch ($_ngcc_current_state) {
124: case 1: {
125: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
126: .equals("annotation"))) {
127: $runtime.onLeaveElementConsumed($__uri, $__local,
128: $__qname);
129: $_ngcc_current_state = 0;
130: } else {
131: unexpectedLeaveElement($__qname);
132: }
133: }
134: break;
135: case 0: {
136: revertToParentFromLeaveElement(makeResult(), super ._cookie,
137: $__uri, $__local, $__qname);
138: }
139: break;
140: default: {
141: unexpectedLeaveElement($__qname);
142: }
143: break;
144: }
145: }
146:
147: public void enterAttribute(String $__uri, String $__local,
148: String $__qname) throws SAXException {
149: int $ai;
150: $uri = $__uri;
151: $localName = $__local;
152: $qname = $__qname;
153: switch ($_ngcc_current_state) {
154: case 0: {
155: revertToParentFromEnterAttribute(makeResult(),
156: super ._cookie, $__uri, $__local, $__qname);
157: }
158: break;
159: default: {
160: unexpectedEnterAttribute($__qname);
161: }
162: break;
163: }
164: }
165:
166: public void leaveAttribute(String $__uri, String $__local,
167: String $__qname) throws SAXException {
168: int $ai;
169: $uri = $__uri;
170: $localName = $__local;
171: $qname = $__qname;
172: switch ($_ngcc_current_state) {
173: case 0: {
174: revertToParentFromLeaveAttribute(makeResult(),
175: super ._cookie, $__uri, $__local, $__qname);
176: }
177: break;
178: default: {
179: unexpectedLeaveAttribute($__qname);
180: }
181: break;
182: }
183: }
184:
185: public void text(String $value) throws SAXException {
186: int $ai;
187: switch ($_ngcc_current_state) {
188: case 0: {
189: revertToParentFromText(makeResult(), super ._cookie, $value);
190: }
191: break;
192: }
193: }
194:
195: public void onChildCompleted(Object $__result__, int $__cookie__,
196: boolean $__needAttCheck__) throws SAXException {
197: switch ($__cookie__) {
198: }
199: }
200:
201: public boolean accepted() {
202: return (($_ngcc_current_state == 0));
203: }
204:
205: private AnnotationParser parser;
206: private Locator locator;
207:
208: public AnnotationImpl makeResult() {
209: Object e = null;
210: if (existing != null)
211: e = existing.getAnnotation();
212:
213: return new AnnotationImpl(parser.getResult(e), locator);
214: }
215:
216: }
|