001: /* this file is generated by RelaxNGCC */
002: package com.sun.xml.xsom.impl.parser.state;
003:
004: import org.xml.sax.SAXException;
005: import org.xml.sax.XMLReader;
006: import org.xml.sax.Attributes;
007: import com.sun.xml.xsom.impl.parser.NGCCRuntimeEx;
008:
009: import com.sun.xml.xsom.*;
010: import com.sun.xml.xsom.parser.*;
011: import com.sun.xml.xsom.impl.*;
012: import com.sun.xml.xsom.impl.parser.*;
013: import org.xml.sax.Locator;
014: import org.xml.sax.ContentHandler;
015: import org.xml.sax.helpers.*;
016: import java.util.*;
017:
018: import com.sun.xml.xsom.parser.AnnotationParser;
019:
020: class annotation extends NGCCHandler {
021: private AnnotationContext context;
022: private AnnotationImpl existing;
023: protected final NGCCRuntimeEx $runtime;
024: private int $_ngcc_current_state;
025: protected String $uri;
026: protected String $localName;
027: protected String $qname;
028:
029: public final NGCCRuntime getRuntime() {
030: return ($runtime);
031: }
032:
033: public annotation(NGCCHandler parent, NGCCEventSource source,
034: NGCCRuntimeEx runtime, int cookie,
035: AnnotationImpl _existing, AnnotationContext _context) {
036: super (source, parent, cookie);
037: $runtime = runtime;
038: this .existing = _existing;
039: this .context = _context;
040: $_ngcc_current_state = 2;
041: }
042:
043: public annotation(NGCCRuntimeEx runtime, AnnotationImpl _existing,
044: AnnotationContext _context) {
045: this (null, runtime, runtime, -1, _existing, _context);
046: }
047:
048: private void action0() throws SAXException {
049:
050: locator = $runtime.copyLocator();
051: parser = $runtime.createAnnotationParser();
052: $runtime
053: .redirectSubtree(parser.getContentHandler(context,
054: $runtime.getAnnotationContextElementName(),
055: $runtime.getErrorHandler(), $runtime.parser
056: .getEntityResolver()), $uri,
057: $localName, $qname);
058:
059: }
060:
061: public void enterElement(String $__uri, String $__local,
062: String $__qname, Attributes $attrs) throws SAXException {
063: int $ai;
064: $uri = $__uri;
065: $localName = $__local;
066: $qname = $__qname;
067: switch ($_ngcc_current_state) {
068: case 0: {
069: revertToParentFromEnterElement(makeResult(), super ._cookie,
070: $__uri, $__local, $__qname, $attrs);
071: }
072: break;
073: case 2: {
074: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
075: .equals("annotation"))) {
076: $runtime.onEnterElementConsumed($__uri, $__local,
077: $__qname, $attrs);
078: action0();
079: $_ngcc_current_state = 1;
080: } else {
081: unexpectedEnterElement($__qname);
082: }
083: }
084: break;
085: default: {
086: unexpectedEnterElement($__qname);
087: }
088: break;
089: }
090: }
091:
092: public void leaveElement(String $__uri, String $__local,
093: String $__qname) throws SAXException {
094: int $ai;
095: $uri = $__uri;
096: $localName = $__local;
097: $qname = $__qname;
098: switch ($_ngcc_current_state) {
099: case 0: {
100: revertToParentFromLeaveElement(makeResult(), super ._cookie,
101: $__uri, $__local, $__qname);
102: }
103: break;
104: case 1: {
105: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
106: .equals("annotation"))) {
107: $runtime.onLeaveElementConsumed($__uri, $__local,
108: $__qname);
109: $_ngcc_current_state = 0;
110: } else {
111: unexpectedLeaveElement($__qname);
112: }
113: }
114: break;
115: default: {
116: unexpectedLeaveElement($__qname);
117: }
118: break;
119: }
120: }
121:
122: public void enterAttribute(String $__uri, String $__local,
123: String $__qname) throws SAXException {
124: int $ai;
125: $uri = $__uri;
126: $localName = $__local;
127: $qname = $__qname;
128: switch ($_ngcc_current_state) {
129: case 0: {
130: revertToParentFromEnterAttribute(makeResult(),
131: super ._cookie, $__uri, $__local, $__qname);
132: }
133: break;
134: default: {
135: unexpectedEnterAttribute($__qname);
136: }
137: break;
138: }
139: }
140:
141: public void leaveAttribute(String $__uri, String $__local,
142: String $__qname) throws SAXException {
143: int $ai;
144: $uri = $__uri;
145: $localName = $__local;
146: $qname = $__qname;
147: switch ($_ngcc_current_state) {
148: case 0: {
149: revertToParentFromLeaveAttribute(makeResult(),
150: super ._cookie, $__uri, $__local, $__qname);
151: }
152: break;
153: default: {
154: unexpectedLeaveAttribute($__qname);
155: }
156: break;
157: }
158: }
159:
160: public void text(String $value) throws SAXException {
161: int $ai;
162: switch ($_ngcc_current_state) {
163: case 0: {
164: revertToParentFromText(makeResult(), super ._cookie, $value);
165: }
166: break;
167: }
168: }
169:
170: public void onChildCompleted(Object $__result__, int $__cookie__,
171: boolean $__needAttCheck__) throws SAXException {
172: switch ($__cookie__) {
173: }
174: }
175:
176: public boolean accepted() {
177: return (($_ngcc_current_state == 0));
178: }
179:
180: private AnnotationParser parser;
181: private Locator locator;
182:
183: public AnnotationImpl makeResult() {
184: Object e = null;
185: if (existing != null)
186: e = existing.getAnnotation();
187:
188: return new AnnotationImpl(parser.getResult(e), locator);
189: }
190:
191: }
|