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