1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xerces.internal.xni.parser;
23
24import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
25import java.io.IOException;
26import com.sun.org.apache.xerces.internal.xni.XNIException;
27
28/**
29 * This interface defines a generic DTD scanner. This interface
30 * allows a scanner to be used interchangably in existing parser
31 * configurations.
32 * <p>
33 * If the parser configuration uses a DTD scanner that implements
34 * this interface, components should be able to query the scanner
35 * instance from the component manager using the following property
36 * identifier:
37 * <blockquote>
38 *  "http://apache.org/xml/properties/internal/dtd-scanner"
39 * </blockquote>
40 *
41 * @author Andy Clark, IBM
42 *
43 */
44public interface XMLDTDScanner
45    extends XMLDTDSource, XMLDTDContentModelSource {
46
47    //
48    // XMLDTDScanner methods
49    //
50
51    /**
52     * Sets the input source.
53     *
54     * @param inputSource The input source or null.
55     *
56     * @throws IOException Thrown on i/o error.
57     */
58    public void setInputSource(XMLInputSource inputSource) throws IOException;
59
60    /**
61     * Scans the internal subset of the document.
62     *
63     * @param complete True if the scanner should scan the document
64     *                 completely, pushing all events to the registered
65     *                 document handler. A value of false indicates that
66     *                 that the scanner should only scan the next portion
67     *                 of the document and return. A scanner instance is
68     *                 permitted to completely scan a document if it does
69     *                 not support this "pull" scanning model.
70     * @param standalone True if the document was specified as standalone.
71     *                   This value is important for verifying certain
72     *                   well-formedness constraints.
73     * @param hasExternalSubset True if the document has an external DTD.
74     *                          This allows the scanner to properly notify
75     *                          the handler of the end of the DTD in the
76     *                          absence of an external subset.
77     *
78     * @return True if there is more to scan, false otherwise.
79     */
80    public boolean scanDTDInternalSubset(boolean complete, boolean standalone,
81                                         boolean hasExternalSubset)
82        throws IOException, XNIException;
83
84    /**
85     * Scans the external subset of the document.
86     *
87     * @param complete True if the scanner should scan the document
88     *                 completely, pushing all events to the registered
89     *                 document handler. A value of false indicates that
90     *                 that the scanner should only scan the next portion
91     *                 of the document and return. A scanner instance is
92     *                 permitted to completely scan a document if it does
93     *                 not support this "pull" scanning model.
94     *
95     * @return True if there is more to scan, false otherwise.
96     */
97    public boolean scanDTDExternalSubset(boolean complete)
98        throws IOException, XNIException;
99
100    /**
101     * Skip the DTD if javax.xml.stream.supportDTD is false.
102     * @param supportDTD The value of the property javax.xml.stream.supportDTD.
103     * @return true if DTD is skipped, false otherwise.
104     * @throws java.io.IOException if i/o error occurs
105     */
106    public boolean skipDTD(boolean supportDTD)
107        throws IOException;
108
109    public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer);
110} // interface XMLDTDScanner
111