KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xerces > internal > xni > XMLDTDContentModelHandler


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Xerces" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 1999, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package com.sun.org.apache.xerces.internal.xni;
59
60 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource;
61
62 /**
63  * The DTD content model handler interface defines callback methods
64  * to report information items in DTD content models of an element
65  * declaration. Parser components interested in DTD content model
66  * information implement this interface and are registered as the DTD
67  * content model handler on the DTD content model source.
68  *
69  * @see XMLDTDHandler
70  *
71  * @author Andy Clark, IBM
72  *
73  * @version $Id: XMLDTDContentModelHandler.java,v 1.5 2002/12/07 00:07:51 neilg Exp $
74  */

75 public interface XMLDTDContentModelHandler {
76
77     //
78
// Constants
79
//
80

81     // separators
82

83     /**
84      * A choice separator for children and mixed content models. This
85      * separator is used to specify that the allowed child is one of a
86      * collection.
87      * <p>
88      * For example:
89      * <pre>
90      * &lt;!ELEMENT elem (foo|bar)&gt;
91      * &lt;!ELEMENT elem (foo|bar+)&gt;
92      * &lt;!ELEMENT elem (foo|bar|baz)&gt;
93      * &lt;!ELEMENT elem (#PCDATA|foo|bar)*&gt;
94      * </pre>
95      *
96      * @see #SEPARATOR_SEQUENCE
97      */

98     public static final short SEPARATOR_CHOICE = 0;
99
100     /**
101      * A sequence separator for children content models. This separator
102      * is used to specify that the allowed children must follow in the
103      * specified sequence.
104      * <p>
105      * <pre>
106      * &lt;!ELEMENT elem (foo,bar)&gt;
107      * &lt;!ELEMENT elem (foo,bar*)&gt;
108      * &lt;!ELEMENT elem (foo,bar,baz)&gt;
109      * </pre>
110      *
111      * @see #SEPARATOR_CHOICE
112      */

113     public static final short SEPARATOR_SEQUENCE = 1;
114
115     // occurrence counts
116

117     /**
118      * This occurrence count limits the element, choice, or sequence in a
119      * children content model to zero or one. In other words, the child
120      * is optional.
121      * <p>
122      * For example:
123      * <pre>
124      * &lt;!ELEMENT elem (foo?)&gt;
125      * </pre>
126      *
127      * @see #OCCURS_ZERO_OR_MORE
128      * @see #OCCURS_ONE_OR_MORE
129      */

130     public static final short OCCURS_ZERO_OR_ONE = 2;
131
132     /**
133      * This occurrence count limits the element, choice, or sequence in a
134      * children content model to zero or more. In other words, the child
135      * may appear an arbitrary number of times, or not at all. This
136      * occurrence count is also used for mixed content models.
137      * <p>
138      * For example:
139      * <pre>
140      * &lt;!ELEMENT elem (foo*)&gt;
141      * &lt;!ELEMENT elem (#PCDATA|foo|bar)*&gt;
142      * </pre>
143      *
144      * @see #OCCURS_ZERO_OR_ONE
145      * @see #OCCURS_ONE_OR_MORE
146      */

147     public static final short OCCURS_ZERO_OR_MORE = 3;
148
149     /**
150      * This occurrence count limits the element, choice, or sequence in a
151      * children content model to one or more. In other words, the child
152      * may appear an arbitrary number of times, but must appear at least
153      * once.
154      * <p>
155      * For example:
156      * <pre>
157      * &lt;!ELEMENT elem (foo+)&gt;
158      * </pre>
159      *
160      * @see #OCCURS_ZERO_OR_ONE
161      * @see #OCCURS_ZERO_OR_MORE
162      */

163     public static final short OCCURS_ONE_OR_MORE = 4;
164
165     //
166
// XMLDTDContentModelHandler methods
167
//
168

169     /**
170      * The start of a content model. Depending on the type of the content
171      * model, specific methods may be called between the call to the
172      * startContentModel method and the call to the endContentModel method.
173      *
174      * @param elementName The name of the element.
175      * @param augmentations Additional information that may include infoset
176      * augmentations.
177      *
178      * @throws XNIException Thrown by handler to signal an error.
179      */

180     public void startContentModel(String JavaDoc elementName, Augmentations augmentations)
181         throws XNIException;
182
183     /**
184      * A content model of ANY.
185      *
186      * @param augmentations Additional information that may include infoset
187      * augmentations.
188      *
189      * @throws XNIException Thrown by handler to signal an error.
190      *
191      * @see #empty
192      * @see #startGroup
193      */

194     public void any(Augmentations augmentations) throws XNIException;
195
196     /**
197      * A content model of EMPTY.
198      *
199      * @throws XNIException Thrown by handler to signal an error.
200      *
201      * @param augmentations Additional information that may include infoset
202      * augmentations.
203      *
204      * @see #any
205      * @see #startGroup
206      */

207     public void empty(Augmentations augmentations) throws XNIException;
208
209     /**
210      * A start of either a mixed or children content model. A mixed
211      * content model will immediately be followed by a call to the
212      * <code>pcdata()</code> method. A children content model will
213      * contain additional groups and/or elements.
214      *
215      * @param augmentations Additional information that may include infoset
216      * augmentations.
217      *
218      * @throws XNIException Thrown by handler to signal an error.
219      *
220      * @see #any
221      * @see #empty
222      */

223     public void startGroup(Augmentations augmentations) throws XNIException;
224
225     /**
226      * The appearance of "#PCDATA" within a group signifying a
227      * mixed content model. This method will be the first called
228      * following the content model's <code>startGroup()</code>.
229      *
230      * @param augmentations Additional information that may include infoset
231      * augmentations.
232      *
233      * @throws XNIException Thrown by handler to signal an error.
234      *
235      * @see #startGroup
236      */

237     public void pcdata(Augmentations augmentations) throws XNIException;
238
239     /**
240      * A referenced element in a mixed or children content model.
241      *
242      * @param elementName The name of the referenced element.
243      * @param augmentations Additional information that may include infoset
244      * augmentations.
245      *
246      * @throws XNIException Thrown by handler to signal an error.
247      */

248     public void element(String JavaDoc elementName, Augmentations augmentations)
249         throws XNIException;
250
251     /**
252      * The separator between choices or sequences of a mixed or children
253      * content model.
254      *
255      * @param separator The type of children separator.
256      * @param augmentations Additional information that may include infoset
257      * augmentations.
258      *
259      * @throws XNIException Thrown by handler to signal an error.
260      *
261      * @see #SEPARATOR_CHOICE
262      * @see #SEPARATOR_SEQUENCE
263      */

264     public void separator(short separator, Augmentations augmentations)
265         throws XNIException;
266
267     /**
268      * The occurrence count for a child in a children content model or
269      * for the mixed content model group.
270      *
271      * @param occurrence The occurrence count for the last element
272      * or group.
273      * @param augmentations Additional information that may include infoset
274      * augmentations.
275      *
276      * @throws XNIException Thrown by handler to signal an error.
277      *
278      * @see #OCCURS_ZERO_OR_ONE
279      * @see #OCCURS_ZERO_OR_MORE
280      * @see #OCCURS_ONE_OR_MORE
281      */

282     public void occurrence(short occurrence, Augmentations augmentations)
283         throws XNIException;
284
285     /**
286      * The end of a group for mixed or children content models.
287      *
288      * @param augmentations Additional information that may include infoset
289      * augmentations.
290      *
291      * @throws XNIException Thrown by handler to signal an error.
292      */

293     public void endGroup(Augmentations augmentations) throws XNIException;
294
295     /**
296      * The end of a content model.
297      *
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 endContentModel(Augmentations augmentations) throws XNIException;
304
305     // set content model source
306
public void setDTDContentModelSource(XMLDTDContentModelSource source);
307
308     // get content model source
309
public XMLDTDContentModelSource getDTDContentModelSource();
310
311 } // interface XMLDTDContentModelHandler
312
Popular Tags