src/share/jaxws_classes/com/sun/xml/internal/dtdparser/DTDEventListener.java

Tue, 06 Mar 2012 16:09:35 -0800

author
ohair
date
Tue, 06 Mar 2012 16:09:35 -0800
changeset 286
f50545b5e2f1
child 397
b99d7e355d4b
permissions
-rw-r--r--

7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom

ohair@286 1 /*
ohair@286 2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.xml.internal.dtdparser;
ohair@286 27
ohair@286 28 import org.xml.sax.Locator;
ohair@286 29 import org.xml.sax.SAXException;
ohair@286 30 import org.xml.sax.SAXParseException;
ohair@286 31
ohair@286 32 import java.util.EventListener;
ohair@286 33
ohair@286 34 /**
ohair@286 35 * All DTD parsing events are signaled through this interface.
ohair@286 36 */
ohair@286 37 public interface DTDEventListener extends EventListener {
ohair@286 38
ohair@286 39 public void setDocumentLocator(Locator loc);
ohair@286 40
ohair@286 41 /**
ohair@286 42 * Receive notification of a Processing Instruction.
ohair@286 43 * Processing instructions contain information meaningful
ohair@286 44 * to the application.
ohair@286 45 *
ohair@286 46 * @param target The target of the proceessing instruction
ohair@286 47 * which should have meaning to the application.
ohair@286 48 * @param data The instruction itself which should contain
ohair@286 49 * valid XML characters.
ohair@286 50 * @throws SAXException
ohair@286 51 */
ohair@286 52 public void processingInstruction(String target, String data)
ohair@286 53 throws SAXException;
ohair@286 54
ohair@286 55 /**
ohair@286 56 * Receive notification of a Notation Declaration.
ohair@286 57 * Notation declarations are used by elements and entities
ohair@286 58 * for identifying embedded non-XML data.
ohair@286 59 *
ohair@286 60 * @param name The notation name, referred to by entities and
ohair@286 61 * elements.
ohair@286 62 * @param publicId The public identifier
ohair@286 63 * @param systemId The system identifier
ohair@286 64 */
ohair@286 65 public void notationDecl(String name, String publicId, String systemId)
ohair@286 66 throws SAXException;
ohair@286 67
ohair@286 68 /**
ohair@286 69 * Receive notification of an unparsed entity declaration.
ohair@286 70 * Unparsed entities are non-XML data.
ohair@286 71 *
ohair@286 72 * @param name The name of the unparsed entity.
ohair@286 73 * @param publicId The public identifier
ohair@286 74 * @param systemId The system identifier
ohair@286 75 * @param notationName The associated notation
ohair@286 76 */
ohair@286 77 public void unparsedEntityDecl(String name, String publicId,
ohair@286 78 String systemId, String notationName)
ohair@286 79 throws SAXException;
ohair@286 80
ohair@286 81 /**
ohair@286 82 * Receive notification of a internal general entity declaration event.
ohair@286 83 *
ohair@286 84 * @param name The internal general entity name.
ohair@286 85 * @param value The value of the entity, which may include unexpanded
ohair@286 86 * entity references. Character references will have been
ohair@286 87 * expanded.
ohair@286 88 * @throws SAXException
ohair@286 89 * @see #externalGeneralEntityDecl(String, String, String)
ohair@286 90 */
ohair@286 91 public void internalGeneralEntityDecl(String name, String value)
ohair@286 92 throws SAXException;
ohair@286 93
ohair@286 94 /**
ohair@286 95 * Receive notification of an external parsed general entity
ohair@286 96 * declaration event.
ohair@286 97 * <p/>
ohair@286 98 * <p>If a system identifier is present, and it is a relative URL, the
ohair@286 99 * parser will have resolved it fully before passing it through this
ohair@286 100 * method to a listener.</p>
ohair@286 101 *
ohair@286 102 * @param name The entity name.
ohair@286 103 * @param publicId The entity's public identifier, or null if
ohair@286 104 * none was given.
ohair@286 105 * @param systemId The entity's system identifier.
ohair@286 106 * @throws SAXException
ohair@286 107 * @see #unparsedEntityDecl(String, String, String, String)
ohair@286 108 */
ohair@286 109 public void externalGeneralEntityDecl(String name, String publicId,
ohair@286 110 String systemId)
ohair@286 111 throws SAXException;
ohair@286 112
ohair@286 113 /**
ohair@286 114 * Receive notification of a internal parameter entity declaration
ohair@286 115 * event.
ohair@286 116 *
ohair@286 117 * @param name The internal parameter entity name.
ohair@286 118 * @param value The value of the entity, which may include unexpanded
ohair@286 119 * entity references. Character references will have been
ohair@286 120 * expanded.
ohair@286 121 * @throws SAXException
ohair@286 122 * @see #externalParameterEntityDecl(String, String, String)
ohair@286 123 */
ohair@286 124 public void internalParameterEntityDecl(String name, String value)
ohair@286 125 throws SAXException;
ohair@286 126
ohair@286 127 /**
ohair@286 128 * Receive notification of an external parameter entity declaration
ohair@286 129 * event.
ohair@286 130 * <p/>
ohair@286 131 * <p>If a system identifier is present, and it is a relative URL, the
ohair@286 132 * parser will have resolved it fully before passing it through this
ohair@286 133 * method to a listener.</p>
ohair@286 134 *
ohair@286 135 * @param name The parameter entity name.
ohair@286 136 * @param publicId The entity's public identifier, or null if
ohair@286 137 * none was given.
ohair@286 138 * @param systemId The entity's system identifier.
ohair@286 139 * @throws SAXException
ohair@286 140 * @see #unparsedEntityDecl(String, String, String, String)
ohair@286 141 */
ohair@286 142 public void externalParameterEntityDecl(String name, String publicId,
ohair@286 143 String systemId)
ohair@286 144 throws SAXException;
ohair@286 145
ohair@286 146 /**
ohair@286 147 * Receive notification of the beginning of the DTD.
ohair@286 148 *
ohair@286 149 * @param in Current input entity.
ohair@286 150 * @see #endDTD()
ohair@286 151 */
ohair@286 152 public void startDTD(InputEntity in)
ohair@286 153 throws SAXException;
ohair@286 154
ohair@286 155 /**
ohair@286 156 * Receive notification of the end of a DTD. The parser will invoke
ohair@286 157 * this method only once.
ohair@286 158 *
ohair@286 159 * @throws SAXException
ohair@286 160 * @see #startDTD(InputEntity)
ohair@286 161 */
ohair@286 162 public void endDTD()
ohair@286 163 throws SAXException;
ohair@286 164
ohair@286 165 /**
ohair@286 166 * Receive notification that a comment has been read.
ohair@286 167 * <p/>
ohair@286 168 * <P> Note that processing instructions are the mechanism designed
ohair@286 169 * to hold information for consumption by applications, not comments.
ohair@286 170 * XML systems may rely on applications being able to access information
ohair@286 171 * found in processing instructions; this is not true of comments, which
ohair@286 172 * are typically discarded.
ohair@286 173 *
ohair@286 174 * @param text the text within the comment delimiters.
ohair@286 175 * @throws SAXException
ohair@286 176 */
ohair@286 177 public void comment(String text)
ohair@286 178 throws SAXException;
ohair@286 179
ohair@286 180 /**
ohair@286 181 * Receive notification of character data.
ohair@286 182 * <p/>
ohair@286 183 * <p>The Parser will call this method to report each chunk of
ohair@286 184 * character data. SAX parsers may return all contiguous character
ohair@286 185 * data in a single chunk, or they may split it into several
ohair@286 186 * chunks; however, all of the characters in any single event
ohair@286 187 * must come from the same external entity, so that the Locator
ohair@286 188 * provides useful information.</p>
ohair@286 189 * <p/>
ohair@286 190 * <p>The application must not attempt to read from the array
ohair@286 191 * outside of the specified range.</p>
ohair@286 192 * <p/>
ohair@286 193 * <p>Note that some parsers will report whitespace using the
ohair@286 194 * ignorableWhitespace() method rather than this one (validating
ohair@286 195 * parsers must do so).</p>
ohair@286 196 *
ohair@286 197 * @param ch The characters from the DTD.
ohair@286 198 * @param start The start position in the array.
ohair@286 199 * @param length The number of characters to read from the array.
ohair@286 200 * @throws SAXException
ohair@286 201 * @see #ignorableWhitespace(char[], int, int)
ohair@286 202 */
ohair@286 203 public void characters(char ch[], int start, int length)
ohair@286 204 throws SAXException;
ohair@286 205
ohair@286 206
ohair@286 207 /**
ohair@286 208 * Receive notification of ignorable whitespace in element content.
ohair@286 209 * <p/>
ohair@286 210 * <p>Validating Parsers must use this method to report each chunk
ohair@286 211 * of ignorable whitespace (see the W3C XML 1.0 recommendation,
ohair@286 212 * section 2.10): non-validating parsers may also use this method
ohair@286 213 * if they are capable of parsing and using content models.</p>
ohair@286 214 * <p/>
ohair@286 215 * <p>SAX parsers may return all contiguous whitespace in a single
ohair@286 216 * chunk, or they may split it into several chunks; however, all of
ohair@286 217 * the characters in any single event must come from the same
ohair@286 218 * external entity, so that the Locator provides useful
ohair@286 219 * information.</p>
ohair@286 220 * <p/>
ohair@286 221 * <p>The application must not attempt to read from the array
ohair@286 222 * outside of the specified range.</p>
ohair@286 223 *
ohair@286 224 * @param ch The characters from the DTD.
ohair@286 225 * @param start The start position in the array.
ohair@286 226 * @param length The number of characters to read from the array.
ohair@286 227 * @throws SAXException
ohair@286 228 * @see #characters(char[], int, int)
ohair@286 229 */
ohair@286 230 public void ignorableWhitespace(char ch[], int start, int length)
ohair@286 231 throws SAXException;
ohair@286 232
ohair@286 233 /**
ohair@286 234 * Receive notification that a CDATA section is beginning. Data in a
ohair@286 235 * CDATA section is is reported through the appropriate event, either
ohair@286 236 * <em>characters()</em> or <em>ignorableWhitespace</em>.
ohair@286 237 *
ohair@286 238 * @throws SAXException
ohair@286 239 * @see #endCDATA()
ohair@286 240 */
ohair@286 241 public void startCDATA() throws SAXException;
ohair@286 242
ohair@286 243
ohair@286 244 /**
ohair@286 245 * Receive notification that the CDATA section finished.
ohair@286 246 *
ohair@286 247 * @throws SAXException
ohair@286 248 * @see #startCDATA()
ohair@286 249 */
ohair@286 250 public void endCDATA() throws SAXException;
ohair@286 251
ohair@286 252
ohair@286 253 public void fatalError(SAXParseException e)
ohair@286 254 throws SAXException;
ohair@286 255
ohair@286 256 public void error(SAXParseException e) throws SAXException;
ohair@286 257
ohair@286 258 public void warning(SAXParseException err) throws SAXException;
ohair@286 259
ohair@286 260 public final short CONTENT_MODEL_EMPTY = 0;
ohair@286 261 public final short CONTENT_MODEL_ANY = 1;
ohair@286 262 public final short CONTENT_MODEL_MIXED = 2;
ohair@286 263 public final short CONTENT_MODEL_CHILDREN = 3;
ohair@286 264
ohair@286 265 /**
ohair@286 266 * receives notification that parsing of content model is beginning.
ohair@286 267 *
ohair@286 268 * @param elementName name of the element whose content model is going to be defined.
ohair@286 269 * @param contentModelType {@link #CONTENT_MODEL_EMPTY}
ohair@286 270 * this element has EMPTY content model. This notification
ohair@286 271 * will be immediately followed by the corresponding endContentModel.
ohair@286 272 * {@link #CONTENT_MODEL_ANY}
ohair@286 273 * this element has ANY content model. This notification
ohair@286 274 * will be immediately followed by the corresponding endContentModel.
ohair@286 275 * {@link #CONTENT_MODEL_MIXED}
ohair@286 276 * this element has mixed content model. #PCDATA will not be reported.
ohair@286 277 * each child element will be reported by mixedElement method.
ohair@286 278 * {@link #CONTENT_MODEL_CHILDREN}
ohair@286 279 * this elemen has child content model. The actual content model will
ohair@286 280 * be reported by childElement, startModelGroup, endModelGroup, and
ohair@286 281 * connector methods. Possible call sequences are:
ohair@286 282 * <p/>
ohair@286 283 * START := MODEL_GROUP
ohair@286 284 * MODEL_GROUP := startModelGroup TOKEN (connector TOKEN)* endModelGroup
ohair@286 285 * TOKEN := childElement
ohair@286 286 * | MODEL_GROUP
ohair@286 287 */
ohair@286 288 public void startContentModel(String elementName, short contentModelType) throws SAXException;
ohair@286 289
ohair@286 290 /**
ohair@286 291 * receives notification that parsing of content model is finished.
ohair@286 292 */
ohair@286 293 public void endContentModel(String elementName, short contentModelType) throws SAXException;
ohair@286 294
ohair@286 295 public final short USE_NORMAL = 0;
ohair@286 296 public final short USE_IMPLIED = 1;
ohair@286 297 public final short USE_FIXED = 2;
ohair@286 298 public final short USE_REQUIRED = 3;
ohair@286 299
ohair@286 300 /**
ohair@286 301 * For each entry in an ATTLIST declaration,
ohair@286 302 * this event will be fired.
ohair@286 303 * <p/>
ohair@286 304 * <p/>
ohair@286 305 * DTD allows the same attributes to be declared more than
ohair@286 306 * once, and in that case the first one wins. I think
ohair@286 307 * this method will be only fired for the first one,
ohair@286 308 * but I need to check.
ohair@286 309 */
ohair@286 310 public void attributeDecl(String elementName, String attributeName, String attributeType,
ohair@286 311 String[] enumeration, short attributeUse, String defaultValue) throws SAXException;
ohair@286 312
ohair@286 313 public void childElement(String elementName, short occurence) throws SAXException;
ohair@286 314
ohair@286 315 /**
ohair@286 316 * receives notification of child element of mixed content model.
ohair@286 317 * this method is called for each child element.
ohair@286 318 *
ohair@286 319 * @see #startContentModel(String, short)
ohair@286 320 */
ohair@286 321 public void mixedElement(String elementName) throws SAXException;
ohair@286 322
ohair@286 323 public void startModelGroup() throws SAXException;
ohair@286 324
ohair@286 325 public void endModelGroup(short occurence) throws SAXException;
ohair@286 326
ohair@286 327 public final short CHOICE = 0;
ohair@286 328 public final short SEQUENCE = 1;
ohair@286 329
ohair@286 330 /**
ohair@286 331 * Connectors in one model group is guaranteed to be the same.
ohair@286 332 * <p/>
ohair@286 333 * <p/>
ohair@286 334 * IOW, you'll never see an event sequence like (a|b,c)
ohair@286 335 *
ohair@286 336 * @return {@link #CHOICE} or {@link #SEQUENCE}.
ohair@286 337 */
ohair@286 338 public void connector(short connectorType) throws SAXException;
ohair@286 339
ohair@286 340 public final short OCCURENCE_ZERO_OR_MORE = 0;
ohair@286 341 public final short OCCURENCE_ONE_OR_MORE = 1;
ohair@286 342 public final short OCCURENCE_ZERO_OR_ONE = 2;
ohair@286 343 public final short OCCURENCE_ONCE = 3;
ohair@286 344 }

mercurial