KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > dtm > ref > IncrementalSAXSource


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: IncrementalSAXSource.java,v 1.6 2004/02/16 23:06:11 minchau Exp $
18  */

19
20 package org.apache.xml.dtm.ref;
21
22 import org.xml.sax.ContentHandler JavaDoc;
23 import org.xml.sax.InputSource JavaDoc;
24 import org.xml.sax.SAXException JavaDoc;
25
26 /** <p>IncrementalSAXSource is an API that delivers a small number of
27  * SAX events each time a request is made from a "controller"
28  * coroutine. See IncrementalSAXFilter and IncrementalSAXFilter_Xerces
29  * for examples.
30  *
31  * Note that interaction is via the deliverMoreNodes
32  * method, and therefore coroutine support is not exposed
33  * here.</p>
34  * */

35 public interface IncrementalSAXSource
36 {
37   // ------------------------------------------------------------------
38
// SAX Output API
39
// ------------------------------------------------------------------
40

41   /** Register a SAX-style content handler for us to output to
42    */

43   public void setContentHandler(ContentHandler JavaDoc handler);
44
45   /** Register a SAX-style lexical handler for us to output to
46    */

47   public void setLexicalHandler(org.xml.sax.ext.LexicalHandler JavaDoc handler);
48
49   /** Register a SAX-style DTD handler for us to output to
50    */

51   public void setDTDHandler(org.xml.sax.DTDHandler JavaDoc handler);
52
53   // ------------------------------------------------------------------
54
// Command Input API
55
// ------------------------------------------------------------------
56

57   /** deliverMoreNodes() is a simple API which tells the thread in which the
58    * IncrementalSAXSource is running to deliver more events (true),
59    * or stop delivering events and close out its input (false).
60    *
61    * This is intended to be called from one of our partner coroutines,
62    * and serves to encapsulate the coroutine communication protocol.
63    *
64    * @param parsemore If true, tells the incremental SAX stream to deliver
65    * another chunk of events. If false, finishes out the stream.
66    *
67    * @return Boolean.TRUE if the IncrementalSAXSource believes more data
68    * may be available for further parsing. Boolean.FALSE if parsing
69    * ran to completion, or was ended by deliverMoreNodes(false).
70    * */

71   public Object JavaDoc deliverMoreNodes (boolean parsemore);
72
73   // ------------------------------------------------------------------
74
// Parse Thread Convenience API
75
// ------------------------------------------------------------------
76

77   /** Launch an XMLReader's parsing operation, feeding events to this
78    * IncrementalSAXSource. In some implementations, this may launch a
79    * thread which runs the previously supplied XMLReader's parse() operation.
80    * In others, it may do other forms of initialization.
81    *
82    * @throws SAXException is parse thread is already in progress
83    * or parsing can not be started.
84    * */

85   public void startParse(InputSource JavaDoc source) throws SAXException JavaDoc;
86     
87 } // class IncrementalSAXSource
88
Popular Tags