aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /* this file is generated by RelaxNGCC */ aoqi@0: package com.sun.xml.internal.xsom.impl.parser.state; aoqi@0: import org.xml.sax.SAXException; aoqi@0: import org.xml.sax.XMLReader; aoqi@0: import org.xml.sax.Attributes; aoqi@0: import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx; aoqi@0: aoqi@0: import com.sun.xml.internal.xsom.*; aoqi@0: import com.sun.xml.internal.xsom.parser.*; aoqi@0: import com.sun.xml.internal.xsom.impl.*; aoqi@0: import com.sun.xml.internal.xsom.impl.parser.*; aoqi@0: import org.xml.sax.Locator; aoqi@0: import org.xml.sax.ContentHandler; aoqi@0: import org.xml.sax.helpers.*; aoqi@0: import java.util.*; aoqi@0: import java.math.BigInteger; aoqi@0: aoqi@0: import java.util.StringTokenizer; aoqi@0: import java.util.HashSet; aoqi@0: aoqi@0: aoqi@0: class wildcardBody extends NGCCHandler { aoqi@0: private AnnotationImpl annotation; aoqi@0: private Locator locator; aoqi@0: private String modeValue; aoqi@0: private String ns; aoqi@0: private ForeignAttributesImpl fa; aoqi@0: protected final NGCCRuntimeEx $runtime; aoqi@0: private int $_ngcc_current_state; aoqi@0: protected String $uri; aoqi@0: protected String $localName; aoqi@0: protected String $qname; aoqi@0: aoqi@0: public final NGCCRuntime getRuntime() { aoqi@0: return($runtime); aoqi@0: } aoqi@0: aoqi@0: public wildcardBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator) { aoqi@0: super(source, parent, cookie); aoqi@0: $runtime = runtime; aoqi@0: this.locator = _locator; aoqi@0: $_ngcc_current_state = 10; aoqi@0: } aoqi@0: aoqi@0: public wildcardBody(NGCCRuntimeEx runtime, Locator _locator) { aoqi@0: this(null, runtime, runtime, -1, _locator); aoqi@0: } aoqi@0: aoqi@0: public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { aoqi@0: int $ai; aoqi@0: $uri = $__uri; aoqi@0: $localName = $__local; aoqi@0: $qname = $__qname; aoqi@0: switch($_ngcc_current_state) { aoqi@0: case 1: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 0; aoqi@0: $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 5: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 1; aoqi@0: $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 9: aoqi@0: { aoqi@0: if((($ai = $runtime.getAttributeIndex("","namespace"))>=0 || ($ai = $runtime.getAttributeIndex("","processContents"))>=0)) { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: else { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 10: aoqi@0: { aoqi@0: if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { aoqi@0: NGCCHandler h = new annotation(this, super._source, $runtime, 411, null,AnnotationContext.WILDCARD); aoqi@0: spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 9; aoqi@0: $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 0: aoqi@0: { aoqi@0: revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs); aoqi@0: } aoqi@0: break; aoqi@0: default: aoqi@0: { aoqi@0: unexpectedEnterElement($__qname); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { aoqi@0: int $ai; aoqi@0: $uri = $__uri; aoqi@0: $localName = $__local; aoqi@0: $qname = $__qname; aoqi@0: switch($_ngcc_current_state) { aoqi@0: case 1: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 0; aoqi@0: $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 5: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 1; aoqi@0: $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 9: aoqi@0: { aoqi@0: if((($ai = $runtime.getAttributeIndex("","namespace"))>=0 || ($ai = $runtime.getAttributeIndex("","processContents"))>=0)) { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: else { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromLeaveElement(h, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 10: aoqi@0: { aoqi@0: $_ngcc_current_state = 9; aoqi@0: $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 0: aoqi@0: { aoqi@0: revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: default: aoqi@0: { aoqi@0: unexpectedLeaveElement($__qname); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { aoqi@0: int $ai; aoqi@0: $uri = $__uri; aoqi@0: $localName = $__local; aoqi@0: $qname = $__qname; aoqi@0: switch($_ngcc_current_state) { aoqi@0: case 1: aoqi@0: { aoqi@0: if(($__uri.equals("") && $__local.equals("namespace"))) { aoqi@0: $_ngcc_current_state = 3; aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 0; aoqi@0: $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 5: aoqi@0: { aoqi@0: if(($__uri.equals("") && $__local.equals("processContents"))) { aoqi@0: $_ngcc_current_state = 7; aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 1; aoqi@0: $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 9: aoqi@0: { aoqi@0: if((($__uri.equals("") && $__local.equals("namespace")) || ($__uri.equals("") && $__local.equals("processContents")))) { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: else { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 10: aoqi@0: { aoqi@0: $_ngcc_current_state = 9; aoqi@0: $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 0: aoqi@0: { aoqi@0: revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: default: aoqi@0: { aoqi@0: unexpectedEnterAttribute($__qname); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { aoqi@0: int $ai; aoqi@0: $uri = $__uri; aoqi@0: $localName = $__local; aoqi@0: $qname = $__qname; aoqi@0: switch($_ngcc_current_state) { aoqi@0: case 1: aoqi@0: { aoqi@0: $_ngcc_current_state = 0; aoqi@0: $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 5: aoqi@0: { aoqi@0: $_ngcc_current_state = 1; aoqi@0: $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 6: aoqi@0: { aoqi@0: if(($__uri.equals("") && $__local.equals("processContents"))) { aoqi@0: $_ngcc_current_state = 1; aoqi@0: } aoqi@0: else { aoqi@0: unexpectedLeaveAttribute($__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 9: aoqi@0: { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 10: aoqi@0: { aoqi@0: $_ngcc_current_state = 9; aoqi@0: $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 0: aoqi@0: { aoqi@0: revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); aoqi@0: } aoqi@0: break; aoqi@0: case 2: aoqi@0: { aoqi@0: if(($__uri.equals("") && $__local.equals("namespace"))) { aoqi@0: $_ngcc_current_state = 0; aoqi@0: } aoqi@0: else { aoqi@0: unexpectedLeaveAttribute($__qname); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: default: aoqi@0: { aoqi@0: unexpectedLeaveAttribute($__qname); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public void text(String $value) throws SAXException { aoqi@0: int $ai; aoqi@0: switch($_ngcc_current_state) { aoqi@0: case 1: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendText(super._cookie, $value); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 0; aoqi@0: $runtime.sendText(super._cookie, $value); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 3: aoqi@0: { aoqi@0: ns = $value; aoqi@0: $_ngcc_current_state = 2; aoqi@0: } aoqi@0: break; aoqi@0: case 5: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { aoqi@0: $runtime.consumeAttribute($ai); aoqi@0: $runtime.sendText(super._cookie, $value); aoqi@0: } aoqi@0: else { aoqi@0: $_ngcc_current_state = 1; aoqi@0: $runtime.sendText(super._cookie, $value); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 9: aoqi@0: { aoqi@0: if(($ai = $runtime.getAttributeIndex("","processContents"))>=0) { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromText(h, $value); aoqi@0: } aoqi@0: else { aoqi@0: if(($ai = $runtime.getAttributeIndex("","namespace"))>=0) { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromText(h, $value); aoqi@0: } aoqi@0: else { aoqi@0: NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 409, null); aoqi@0: spawnChildFromText(h, $value); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case 10: aoqi@0: { aoqi@0: $_ngcc_current_state = 9; aoqi@0: $runtime.sendText(super._cookie, $value); aoqi@0: } aoqi@0: break; aoqi@0: case 0: aoqi@0: { aoqi@0: revertToParentFromText(makeResult(), super._cookie, $value); aoqi@0: } aoqi@0: break; aoqi@0: case 7: aoqi@0: { aoqi@0: modeValue = $value; aoqi@0: $_ngcc_current_state = 6; aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { aoqi@0: switch($__cookie__) { aoqi@0: case 409: aoqi@0: { aoqi@0: fa = ((ForeignAttributesImpl)$__result__); aoqi@0: $_ngcc_current_state = 5; aoqi@0: } aoqi@0: break; aoqi@0: case 411: aoqi@0: { aoqi@0: annotation = ((AnnotationImpl)$__result__); aoqi@0: $_ngcc_current_state = 9; aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: public boolean accepted() { aoqi@0: return((($_ngcc_current_state == 0) || (($_ngcc_current_state == 5) || ($_ngcc_current_state == 1)))); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: private WildcardImpl makeResult() { aoqi@0: if(modeValue==null) modeValue="strict"; aoqi@0: aoqi@0: int mode=-1; aoqi@0: if(modeValue.equals("strict")) mode = XSWildcard.STRTICT; aoqi@0: if(modeValue.equals("lax")) mode = XSWildcard.LAX; aoqi@0: if(modeValue.equals("skip")) mode = XSWildcard.SKIP; aoqi@0: if(mode==-1) throw new InternalError(); aoqi@0: aoqi@0: if(ns==null || ns.equals("##any")) aoqi@0: return new WildcardImpl.Any( $runtime.document, annotation,locator,fa,mode); aoqi@0: aoqi@0: if(ns.equals("##other")) aoqi@0: return new WildcardImpl.Other( $runtime.document, aoqi@0: annotation,locator,fa, aoqi@0: $runtime.currentSchema.getTargetNamespace(),mode); aoqi@0: aoqi@0: StringTokenizer tokens = new StringTokenizer(ns); aoqi@0: HashSet s = new HashSet(); aoqi@0: while(tokens.hasMoreTokens()) { aoqi@0: String ns = tokens.nextToken(); aoqi@0: if(ns.equals("##local")) ns=""; aoqi@0: if(ns.equals("##targetNamespace")) ns=$runtime.currentSchema.getTargetNamespace(); aoqi@0: s.add(ns); aoqi@0: } aoqi@0: aoqi@0: return new WildcardImpl.Finite( $runtime.document, annotation,locator,fa,s,mode); aoqi@0: } aoqi@0: aoqi@0: }