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 erSet extends NGCCHandler {
044: private String v;
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 erSet(NGCCHandler parent, NGCCEventSource source,
056: NGCCRuntimeEx runtime, int cookie) {
057: super (source, parent, cookie);
058: $runtime = runtime;
059: $_ngcc_current_state = 1;
060: }
061:
062: public erSet(NGCCRuntimeEx runtime) {
063: this (null, runtime, runtime, -1);
064: }
065:
066: public void enterElement(String $__uri, String $__local,
067: String $__qname, Attributes $attrs) throws SAXException {
068: int $ai;
069: $uri = $__uri;
070: $localName = $__local;
071: $qname = $__qname;
072: switch ($_ngcc_current_state) {
073: case 0: {
074: revertToParentFromEnterElement(makeResult(), super ._cookie,
075: $__uri, $__local, $__qname, $attrs);
076: }
077: break;
078: default: {
079: unexpectedEnterElement($__qname);
080: }
081: break;
082: }
083: }
084:
085: public void leaveElement(String $__uri, String $__local,
086: String $__qname) throws SAXException {
087: int $ai;
088: $uri = $__uri;
089: $localName = $__local;
090: $qname = $__qname;
091: switch ($_ngcc_current_state) {
092: case 0: {
093: revertToParentFromLeaveElement(makeResult(), super ._cookie,
094: $__uri, $__local, $__qname);
095: }
096: break;
097: default: {
098: unexpectedLeaveElement($__qname);
099: }
100: break;
101: }
102: }
103:
104: public void enterAttribute(String $__uri, String $__local,
105: String $__qname) throws SAXException {
106: int $ai;
107: $uri = $__uri;
108: $localName = $__local;
109: $qname = $__qname;
110: switch ($_ngcc_current_state) {
111: case 0: {
112: revertToParentFromEnterAttribute(makeResult(),
113: super ._cookie, $__uri, $__local, $__qname);
114: }
115: break;
116: default: {
117: unexpectedEnterAttribute($__qname);
118: }
119: break;
120: }
121: }
122:
123: public void leaveAttribute(String $__uri, String $__local,
124: String $__qname) throws SAXException {
125: int $ai;
126: $uri = $__uri;
127: $localName = $__local;
128: $qname = $__qname;
129: switch ($_ngcc_current_state) {
130: case 0: {
131: revertToParentFromLeaveAttribute(makeResult(),
132: super ._cookie, $__uri, $__local, $__qname);
133: }
134: break;
135: default: {
136: unexpectedLeaveAttribute($__qname);
137: }
138: break;
139: }
140: }
141:
142: public void text(String $value) throws SAXException {
143: int $ai;
144: switch ($_ngcc_current_state) {
145: case 0: {
146: revertToParentFromText(makeResult(), super ._cookie, $value);
147: }
148: break;
149: case 1: {
150: v = $value;
151: $_ngcc_current_state = 0;
152: }
153: break;
154: }
155: }
156:
157: public void onChildCompleted(Object $__result__, int $__cookie__,
158: boolean $__needAttCheck__) throws SAXException {
159: switch ($__cookie__) {
160: }
161: }
162:
163: public boolean accepted() {
164: return (($_ngcc_current_state == 0));
165: }
166:
167: private Integer makeResult() {
168: if (v == null)
169: return new Integer($runtime.finalDefault);
170:
171: if (v.indexOf("#all") != -1)
172: return new Integer(XSType.EXTENSION | XSType.RESTRICTION);
173:
174: int r = 0;
175:
176: if (v.indexOf("extension") != -1)
177: r |= XSType.EXTENSION;
178: if (v.indexOf("restriction") != -1)
179: r |= XSType.RESTRICTION;
180:
181: return new Integer(r);
182: }
183:
184: }
|