simpleType.java revision 325
0N/A/*
0N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
0N/A
0N/A/* this file is generated by RelaxNGCC */
0N/Apackage com.sun.xml.internal.xsom.impl.parser.state;
0N/Aimport org.xml.sax.SAXException;
0N/Aimport org.xml.sax.XMLReader;
0N/Aimport org.xml.sax.Attributes;
0N/Aimport com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
0N/A
0N/A import com.sun.xml.internal.xsom.*;
0N/A import com.sun.xml.internal.xsom.parser.*;
0N/A import com.sun.xml.internal.xsom.impl.*;
0N/A import com.sun.xml.internal.xsom.impl.parser.*;
0N/A import org.xml.sax.Locator;
0N/A import org.xml.sax.ContentHandler;
0N/A import org.xml.sax.helpers.*;
0N/A import java.util.*;
0N/A import java.math.BigInteger;
0N/A
0N/A
0N/A
0N/Aclass simpleType extends NGCCHandler {
0N/A private AnnotationImpl annotation;
0N/A private String name;
0N/A private ForeignAttributesImpl fa;
0N/A private String finalValue;
0N/A protected final NGCCRuntimeEx $runtime;
0N/A private int $_ngcc_current_state;
0N/A protected String $uri;
0N/A protected String $localName;
0N/A protected String $qname;
0N/A
0N/A public final NGCCRuntime getRuntime() {
0N/A return($runtime);
0N/A }
0N/A
0N/A public simpleType(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
0N/A super(source, parent, cookie);
0N/A $runtime = runtime;
0N/A $_ngcc_current_state = 19;
0N/A }
0N/A
0N/A public simpleType(NGCCRuntimeEx runtime) {
0N/A this(null, runtime, runtime, -1);
0N/A }
0N/A
0N/A private void action0()throws SAXException {
0N/A finalSet = makeFinalSet(finalValue);
0N/A}
0N/A
0N/A private void action1()throws SAXException {
0N/A locator=$runtime.copyLocator();
0N/A}
0N/A
0N/A public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
0N/A int $ai;
0N/A $uri = $__uri;
0N/A $localName = $__local;
0N/A $qname = $__qname;
0N/A switch($_ngcc_current_state) {
0N/A case 2:
0N/A {
0N/A if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction"))) {
0N/A NGCCHandler h = new SimpleType_Restriction(this, super._source, $runtime, 182, annotation,locator,fa,name,finalSet);
0N/A spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
0N/A NGCCHandler h = new SimpleType_List(this, super._source, $runtime, 183, annotation,locator,fa,name,finalSet);
0N/A spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
0N/A NGCCHandler h = new SimpleType_Union(this, super._source, $runtime, 177, annotation,locator,fa,name,finalSet);
0N/A spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A unexpectedEnterElement($__qname);
0N/A }
0N/A }
0N/A }
0N/A }
0N/A break;
0N/A case 7:
0N/A {
0N/A action0();
0N/A $_ngcc_current_state = 2;
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A break;
0N/A case 15:
0N/A {
0N/A if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
0N/A $runtime.consumeAttribute($ai);
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A $_ngcc_current_state = 11;
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A }
0N/A break;
0N/A case 0:
0N/A {
0N/A revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A break;
1147N/A case 11:
0N/A {
0N/A if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
0N/A $runtime.consumeAttribute($ai);
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A $_ngcc_current_state = 10;
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A }
0N/A break;
0N/A case 19:
0N/A {
0N/A if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
0N/A $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
0N/A action1();
0N/A $_ngcc_current_state = 15;
0N/A }
0N/A else {
0N/A unexpectedEnterElement($__qname);
0N/A }
0N/A }
0N/A break;
0N/A case 10:
0N/A {
0N/A if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list")))))) {
0N/A NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 188, fa);
0N/A spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A unexpectedEnterElement($__qname);
0N/A }
0N/A }
0N/A break;
0N/A case 8:
0N/A {
0N/A if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
0N/A NGCCHandler h = new annotation(this, super._source, $runtime, 186, null,AnnotationContext.SIMPLETYPE_DECL);
0N/A spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A else {
0N/A $_ngcc_current_state = 7;
0N/A $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
0N/A }
0N/A }
0N/A break;
0N/A default:
0N/A {
0N/A unexpectedEnterElement($__qname);
0N/A }
0N/A break;
0N/A }
0N/A }
0N/A
0N/A public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
0N/A int $ai;
0N/A $uri = $__uri;
0N/A $localName = $__local;
0N/A $qname = $__qname;
0N/A switch($_ngcc_current_state) {
0N/A case 7:
0N/A {
0N/A action0();
0N/A $_ngcc_current_state = 2;
0N/A $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
0N/A }
0N/A break;
0N/A case 15:
0N/A {
0N/A if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
0N/A $runtime.consumeAttribute($ai);
0N/A $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
0N/A }
0N/A else {
0N/A $_ngcc_current_state = 11;
0N/A $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
0N/A }
0N/A }
0N/A break;
0N/A case 0:
0N/A {
revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
}
break;
case 11:
{
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
}
else {
$_ngcc_current_state = 10;
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
}
}
break;
case 8:
{
$_ngcc_current_state = 7;
$runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
}
break;
case 1:
{
if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
$runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
$_ngcc_current_state = 0;
}
else {
unexpectedLeaveElement($__qname);
}
}
break;
default:
{
unexpectedLeaveElement($__qname);
}
break;
}
}
public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 7:
{
action0();
$_ngcc_current_state = 2;
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 15:
{
if(($__uri.equals("") && $__local.equals("final"))) {
$_ngcc_current_state = 17;
}
else {
$_ngcc_current_state = 11;
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
}
}
break;
case 0:
{
revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
}
break;
case 11:
{
if(($__uri.equals("") && $__local.equals("name"))) {
$_ngcc_current_state = 13;
}
else {
$_ngcc_current_state = 10;
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
}
}
break;
case 8:
{
$_ngcc_current_state = 7;
$runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
default:
{
unexpectedEnterAttribute($__qname);
}
break;
}
}
public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
int $ai;
$uri = $__uri;
$localName = $__local;
$qname = $__qname;
switch($_ngcc_current_state) {
case 7:
{
action0();
$_ngcc_current_state = 2;
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 15:
{
$_ngcc_current_state = 11;
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 16:
{
if(($__uri.equals("") && $__local.equals("final"))) {
$_ngcc_current_state = 11;
}
else {
unexpectedLeaveAttribute($__qname);
}
}
break;
case 12:
{
if(($__uri.equals("") && $__local.equals("name"))) {
$_ngcc_current_state = 10;
}
else {
unexpectedLeaveAttribute($__qname);
}
}
break;
case 0:
{
revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
}
break;
case 11:
{
$_ngcc_current_state = 10;
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
case 8:
{
$_ngcc_current_state = 7;
$runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
}
break;
default:
{
unexpectedLeaveAttribute($__qname);
}
break;
}
}
public void text(String $value) throws SAXException {
int $ai;
switch($_ngcc_current_state) {
case 7:
{
action0();
$_ngcc_current_state = 2;
$runtime.sendText(super._cookie, $value);
}
break;
case 15:
{
if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendText(super._cookie, $value);
}
else {
$_ngcc_current_state = 11;
$runtime.sendText(super._cookie, $value);
}
}
break;
case 13:
{
name = $value;
$_ngcc_current_state = 12;
}
break;
case 0:
{
revertToParentFromText(result, super._cookie, $value);
}
break;
case 11:
{
if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
$runtime.consumeAttribute($ai);
$runtime.sendText(super._cookie, $value);
}
else {
$_ngcc_current_state = 10;
$runtime.sendText(super._cookie, $value);
}
}
break;
case 17:
{
finalValue = $value;
$_ngcc_current_state = 16;
}
break;
case 8:
{
$_ngcc_current_state = 7;
$runtime.sendText(super._cookie, $value);
}
break;
}
}
public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
switch($__cookie__) {
case 186:
{
annotation = ((AnnotationImpl)$__result__);
$_ngcc_current_state = 7;
}
break;
case 188:
{
fa = ((ForeignAttributesImpl)$__result__);
$_ngcc_current_state = 8;
}
break;
case 182:
{
result = ((RestrictionSimpleTypeImpl)$__result__);
$_ngcc_current_state = 1;
}
break;
case 183:
{
result = ((ListSimpleTypeImpl)$__result__);
$_ngcc_current_state = 1;
}
break;
case 177:
{
result = ((UnionSimpleTypeImpl)$__result__);
$_ngcc_current_state = 1;
}
break;
}
}
public boolean accepted() {
return(($_ngcc_current_state == 0));
}
/** computed simple type object */
private SimpleTypeImpl result;
private Locator locator;
private Set finalSet;
private Set makeFinalSet(String finalValue) {
if(finalValue==null)
return Collections.EMPTY_SET;
Set s = new HashSet();
StringTokenizer tokens = new StringTokenizer(finalValue);
while(tokens.hasMoreTokens()) {
String token = tokens.nextToken();
if(token.equals("#all")) {
s.add(XSVariety.ATOMIC);
s.add(XSVariety.UNION);
s.add(XSVariety.LIST);
}
if(token.equals("list")) {
s.add(XSVariety.LIST);
}
if(token.equals("union")) {
s.add(XSVariety.UNION);
}
if(token.equals("restriction")) {
s.add(XSVariety.ATOMIC);
}
}
return s;
}
}