1/* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26/* this file is generated by RelaxNGCC */ 27package com.sun.xml.internal.xsom.impl.parser.state; 28import org.xml.sax.SAXException; 29import org.xml.sax.XMLReader; 30import org.xml.sax.Attributes; 31import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx; 32 33 import com.sun.xml.internal.xsom.*; 34 import com.sun.xml.internal.xsom.parser.*; 35 import com.sun.xml.internal.xsom.impl.*; 36 import com.sun.xml.internal.xsom.impl.parser.*; 37 import org.xml.sax.Locator; 38 import org.xml.sax.ContentHandler; 39 import org.xml.sax.helpers.*; 40 import java.util.*; 41 import java.math.BigInteger; 42 43import com.sun.xml.internal.xsom.parser.AnnotationParser; 44 45 46class annotation extends NGCCHandler { 47 private AnnotationContext context; 48 private AnnotationImpl existing; 49 protected final NGCCRuntimeEx $runtime; 50 private int $_ngcc_current_state; 51 protected String $uri; 52 protected String $localName; 53 protected String $qname; 54 55 public final NGCCRuntime getRuntime() { 56 return($runtime); 57 } 58 59 public annotation(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _existing, AnnotationContext _context) { 60 super(source, parent, cookie); 61 $runtime = runtime; 62 this.existing = _existing; 63 this.context = _context; 64 $_ngcc_current_state = 2; 65 } 66 67 public annotation(NGCCRuntimeEx runtime, AnnotationImpl _existing, AnnotationContext _context) { 68 this(null, runtime, runtime, -1, _existing, _context); 69 } 70 71 private void action0()throws SAXException { 72 73 locator = $runtime.copyLocator(); 74 parser = $runtime.createAnnotationParser(); 75 $runtime.redirectSubtree(parser.getContentHandler( 76 context, 77 $runtime.getAnnotationContextElementName(), 78 $runtime.getErrorHandler(), 79 $runtime.parser.getEntityResolver() 80 ), $uri, $localName, $qname ); 81 82} 83 84 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException { 85 int $ai; 86 $uri = $__uri; 87 $localName = $__local; 88 $qname = $__qname; 89 switch($_ngcc_current_state) { 90 case 0: 91 { 92 revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs); 93 } 94 break; 95 case 2: 96 { 97 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { 98 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs); 99 action0(); 100 $_ngcc_current_state = 1; 101 } 102 else { 103 unexpectedEnterElement($__qname); 104 } 105 } 106 break; 107 default: 108 { 109 unexpectedEnterElement($__qname); 110 } 111 break; 112 } 113 } 114 115 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException { 116 int $ai; 117 $uri = $__uri; 118 $localName = $__local; 119 $qname = $__qname; 120 switch($_ngcc_current_state) { 121 case 1: 122 { 123 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) { 124 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname); 125 $_ngcc_current_state = 0; 126 } 127 else { 128 unexpectedLeaveElement($__qname); 129 } 130 } 131 break; 132 case 0: 133 { 134 revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname); 135 } 136 break; 137 default: 138 { 139 unexpectedLeaveElement($__qname); 140 } 141 break; 142 } 143 } 144 145 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 146 int $ai; 147 $uri = $__uri; 148 $localName = $__local; 149 $qname = $__qname; 150 switch($_ngcc_current_state) { 151 case 0: 152 { 153 revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); 154 } 155 break; 156 default: 157 { 158 unexpectedEnterAttribute($__qname); 159 } 160 break; 161 } 162 } 163 164 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException { 165 int $ai; 166 $uri = $__uri; 167 $localName = $__local; 168 $qname = $__qname; 169 switch($_ngcc_current_state) { 170 case 0: 171 { 172 revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname); 173 } 174 break; 175 default: 176 { 177 unexpectedLeaveAttribute($__qname); 178 } 179 break; 180 } 181 } 182 183 public void text(String $value) throws SAXException { 184 int $ai; 185 switch($_ngcc_current_state) { 186 case 0: 187 { 188 revertToParentFromText(makeResult(), super._cookie, $value); 189 } 190 break; 191 } 192 } 193 194 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException { 195 switch($__cookie__) { 196 } 197 } 198 199 public boolean accepted() { 200 return(($_ngcc_current_state == 0)); 201 } 202 203 204 private AnnotationParser parser; 205 private Locator locator; 206 207 public AnnotationImpl makeResult() { 208 Object e = null; 209 if(existing!=null) e=existing.getAnnotation(); 210 211 return new AnnotationImpl( parser.getResult(e),locator); 212 } 213 214} 215