001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
006: * reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by the
023: * Apache Software Foundation (http://www.apache.org/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. The names "Xerces" and "Apache Software Foundation" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written
030: * permission, please contact apache@apache.org.
031: *
032: * 5. Products derived from this software may not be called "Apache",
033: * nor may "Apache" appear in their name, without prior written
034: * permission of the Apache Software Foundation.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This software consists of voluntary contributions made by many
051: * individuals on behalf of the Apache Software Foundation and was
052: * originally based on software copyright (c) 1999, International
053: * Business Machines, Inc., http://www.apache.org. For more
054: * information on the Apache Software Foundation, please see
055: * <http://www.apache.org/>.
056: */
057:
058: package com.sun.xml.stream.xerces.xni;
059:
060: /**
061: * The DTD handler interface defines callback methods to report
062: * information items in the DTD of an XML document. Parser components
063: * interested in DTD information implement this interface and are
064: * registered as the DTD handler on the DTD source.
065: *
066: * @see XMLDTDContentModelHandler
067: *
068: * @author Andy Clark, IBM
069: *
070: * @version $Id: XMLDTDHandler.java,v 1.2 2006/04/01 06:01:45 jeffsuttor Exp $
071: */
072: public interface XMLDTDHandler {
073:
074: //
075: // Constants
076: //
077:
078: /**
079: * Conditional section: INCLUDE.
080: *
081: * @see #CONDITIONAL_IGNORE
082: */
083: public static final short CONDITIONAL_INCLUDE = 0;
084:
085: /**
086: * Conditional section: IGNORE.
087: *
088: * @see #CONDITIONAL_INCLUDE
089: */
090: public static final short CONDITIONAL_IGNORE = 1;
091:
092: //
093: // XMLDTDHandler methods
094: //
095:
096: /**
097: * The start of the DTD.
098: *
099: * @param locator The document locator, or null if the document
100: * location cannot be reported during the parsing of
101: * the document DTD. However, it is <em>strongly</em>
102: * recommended that a locator be supplied that can
103: * at least report the base system identifier of the
104: * DTD.
105: * @param augmentations Additional information that may include infoset
106: * augmentations.
107: *
108: * @throws XNIException Thrown by handler to signal an error.
109: */
110: public void startDTD(XMLLocator locator, Augmentations augmentations)
111: throws XNIException;
112:
113: /**
114: * This method notifies of the start of a parameter entity. The parameter
115: * entity name start with a '%' character.
116: *
117: * @param name The name of the parameter entity.
118: * @param identifier The resource identifier.
119: * @param encoding The auto-detected IANA encoding name of the entity
120: * stream. This value will be null in those situations
121: * where the entity encoding is not auto-detected (e.g.
122: * internal parameter entities).
123: * @param augmentations Additional information that may include infoset
124: * augmentations.
125: *
126: * @throws XNIException Thrown by handler to signal an error.
127: */
128: public void startParameterEntity(String name,
129: XMLResourceIdentifier identifier, String encoding,
130: Augmentations augmentations) throws XNIException;
131:
132: /**
133: * Notifies of the presence of a TextDecl line in an entity. If present,
134: * this method will be called immediately following the startEntity call.
135: * <p>
136: * <strong>Note:</strong> This method is only called for external
137: * parameter entities referenced in the DTD.
138: *
139: * @param version The XML version, or null if not specified.
140: * @param encoding The IANA encoding name of the entity.
141: * @param augmentations Additional information that may include infoset
142: * augmentations.
143: *
144: * @throws XNIException Thrown by handler to signal an error.
145: */
146: public void textDecl(String version, String encoding,
147: Augmentations augmentations) throws XNIException;
148:
149: /**
150: * This method notifies the end of a parameter entity. Parameter entity
151: * names begin with a '%' character.
152: *
153: * @param name The name of the parameter entity.
154: * @param augmentations Additional information that may include infoset
155: * augmentations.
156: *
157: * @throws XNIException Thrown by handler to signal an error.
158: */
159: public void endParameterEntity(String name,
160: Augmentations augmentations) throws XNIException;
161:
162: /**
163: * The start of the DTD external subset.
164: *
165: * @param identifier The resource identifier.
166: * @param augmentations
167: * Additional information that may include infoset
168: * augmentations.
169: * @exception XNIException
170: * Thrown by handler to signal an error.
171: */
172: public void startExternalSubset(XMLResourceIdentifier identifier,
173: Augmentations augmentations) throws XNIException;
174:
175: /**
176: * The end of the DTD external subset.
177: *
178: * @param augmentations Additional information that may include infoset
179: * augmentations.
180: *
181: * @throws XNIException Thrown by handler to signal an error.
182: */
183: public void endExternalSubset(Augmentations augmentations)
184: throws XNIException;
185:
186: /**
187: * A comment.
188: *
189: * @param text The text in the comment.
190: * @param augmentations Additional information that may include infoset
191: * augmentations.
192: *
193: * @throws XNIException Thrown by application to signal an error.
194: */
195: public void comment(XMLString text, Augmentations augmentations)
196: throws XNIException;
197:
198: /**
199: * A processing instruction. Processing instructions consist of a
200: * target name and, optionally, text data. The data is only meaningful
201: * to the application.
202: * <p>
203: * Typically, a processing instruction's data will contain a series
204: * of pseudo-attributes. These pseudo-attributes follow the form of
205: * element attributes but are <strong>not</strong> parsed or presented
206: * to the application as anything other than text. The application is
207: * responsible for parsing the data.
208: *
209: * @param target The target.
210: * @param data The data or null if none specified.
211: * @param augmentations Additional information that may include infoset
212: * augmentations.
213: *
214: * @throws XNIException Thrown by handler to signal an error.
215: */
216: public void processingInstruction(String target, XMLString data,
217: Augmentations augmentations) throws XNIException;
218:
219: /**
220: * An element declaration.
221: *
222: * @param name The name of the element.
223: * @param contentModel The element content model.
224: * @param augmentations Additional information that may include infoset
225: * augmentations.
226: *
227: * @throws XNIException Thrown by handler to signal an error.
228: */
229: public void elementDecl(String name, String contentModel,
230: Augmentations augmentations) throws XNIException;
231:
232: /**
233: * The start of an attribute list.
234: *
235: * @param elementName The name of the element that this attribute
236: * list is associated with.
237: * @param augmentations Additional information that may include infoset
238: * augmentations.
239: *
240: * @throws XNIException Thrown by handler to signal an error.
241: */
242: public void startAttlist(String elementName,
243: Augmentations augmentations) throws XNIException;
244:
245: /**
246: * An attribute declaration.
247: *
248: * @param elementName The name of the element that this attribute
249: * is associated with.
250: * @param attributeName The name of the attribute.
251: * @param type The attribute type. This value will be one of
252: * the following: "CDATA", "ENTITY", "ENTITIES",
253: * "ENUMERATION", "ID", "IDREF", "IDREFS",
254: * "NMTOKEN", "NMTOKENS", or "NOTATION".
255: * @param enumeration If the type has the value "ENUMERATION" or
256: * "NOTATION", this array holds the allowed attribute
257: * values; otherwise, this array is null.
258: * @param defaultType The attribute default type. This value will be
259: * one of the following: "#FIXED", "#IMPLIED",
260: * "#REQUIRED", or null.
261: * @param defaultValue The attribute default value, or null if no
262: * default value is specified.
263: * @param nonNormalizedDefaultValue The attribute default value with no normalization
264: * performed, or null if no default value is specified.
265: * @param augmentations Additional information that may include infoset
266: * augmentations.
267: *
268: * @throws XNIException Thrown by handler to signal an error.
269: */
270: public void attributeDecl(String elementName, String attributeName,
271: String type, String[] enumeration, String defaultType,
272: XMLString defaultValue,
273: XMLString nonNormalizedDefaultValue,
274: Augmentations augmentations) throws XNIException;
275:
276: /**
277: * The end of an attribute list.
278: *
279: * @param augmentations Additional information that may include infoset
280: * augmentations.
281: *
282: * @throws XNIException Thrown by handler to signal an error.
283: */
284: public void endAttlist(Augmentations augmentations)
285: throws XNIException;
286:
287: /**
288: * An internal entity declaration.
289: *
290: * @param name The name of the entity. Parameter entity names start with
291: * '%', whereas the name of a general entity is just the
292: * entity name.
293: * @param text The value of the entity.
294: * @param nonNormalizedText The non-normalized value of the entity. This
295: * value contains the same sequence of characters that was in
296: * the internal entity declaration, without any entity
297: * references expanded.
298: * @param augmentations Additional information that may include infoset
299: * augmentations.
300: *
301: * @throws XNIException Thrown by handler to signal an error.
302: */
303: public void internalEntityDecl(String name, XMLString text,
304: XMLString nonNormalizedText, Augmentations augmentations)
305: throws XNIException;
306:
307: /**
308: * An external entity declaration.
309: *
310: * @param name The name of the entity. Parameter entity names start
311: * with '%', whereas the name of a general entity is just
312: * the entity name.
313: * @param identifier An object containing all location information
314: * pertinent to this external entity.
315: * @param augmentations Additional information that may include infoset
316: * augmentations.
317: *
318: * @throws XNIException Thrown by handler to signal an error.
319: */
320: public void externalEntityDecl(String name,
321: XMLResourceIdentifier identifier,
322: Augmentations augmentations) throws XNIException;
323:
324: /**
325: * An unparsed entity declaration.
326: *
327: * @param name The name of the entity.
328: * @param identifier An object containing all location information
329: * pertinent to this unparsed entity declaration.
330: * @param notation The name of the notation.
331: * @param augmentations Additional information that may include infoset
332: * augmentations.
333: *
334: * @throws XNIException Thrown by handler to signal an error.
335: */
336: public void unparsedEntityDecl(String name,
337: XMLResourceIdentifier identifier, String notation,
338: Augmentations augmentations) throws XNIException;
339:
340: /**
341: * A notation declaration
342: *
343: * @param name The name of the notation.
344: * @param identifier An object containing all location information
345: * pertinent to this notation.
346: * @param augmentations Additional information that may include infoset
347: * augmentations.
348: *
349: * @throws XNIException Thrown by handler to signal an error.
350: */
351: public void notationDecl(String name,
352: XMLResourceIdentifier identifier,
353: Augmentations augmentations) throws XNIException;
354:
355: /**
356: * The start of a conditional section.
357: *
358: * @param type The type of the conditional section. This value will
359: * either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.
360: * @param augmentations Additional information that may include infoset
361: * augmentations.
362: *
363: * @throws XNIException Thrown by handler to signal an error.
364: *
365: * @see #CONDITIONAL_INCLUDE
366: * @see #CONDITIONAL_IGNORE
367: */
368: public void startConditional(short type, Augmentations augmentations)
369: throws XNIException;
370:
371: /**
372: * Characters within an IGNORE conditional section.
373: *
374: * @param text The ignored text.
375: * @param augmentations Additional information that may include infoset
376: * augmentations.
377: *
378: * @throws XNIException Thrown by handler to signal an error.
379: */
380: public void ignoredCharacters(XMLString text,
381: Augmentations augmentations) throws XNIException;
382:
383: /**
384: * The end of a conditional section.
385: *
386: * @param augmentations Additional information that may include infoset
387: * augmentations.
388: *
389: * @throws XNIException Thrown by handler to signal an error.
390: */
391: public void endConditional(Augmentations augmentations)
392: throws XNIException;
393:
394: /**
395: * The end of the DTD.
396: *
397: * @param augmentations Additional information that may include infoset
398: * augmentations.
399: *
400: * @throws XNIException Thrown by handler to signal an error.
401: */
402: public void endDTD(Augmentations augmentations) throws XNIException;
403:
404: } // interface XMLDTDHandler
|