src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java

Print this page




  31 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  32 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
  33 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
  34 import com.sun.org.apache.xerces.internal.xni.XMLString;
  35 import com.sun.org.apache.xerces.internal.xni.XNIException;
  36 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
  37 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
  38 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
  39 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
  40 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
  41 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  42 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
  43 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
  44 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
  45 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
  46 import com.sun.xml.internal.stream.XMLBufferListener;
  47 import com.sun.xml.internal.stream.XMLEntityStorage;
  48 import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
  49 import java.io.EOFException;
  50 import java.io.IOException;

  51 import javax.xml.stream.XMLInputFactory;
  52 import javax.xml.stream.XMLStreamConstants;
  53 import javax.xml.stream.events.XMLEvent;

  54 
  55 /**
  56  *
  57  * This class is responsible for scanning the structure and content
  58  * of document fragments.
  59  *
  60  * This class has been modified as per the new design which is more suited to
  61  * efficiently build pull parser. Lot of improvements have been done and
  62  * the code has been added to support stax functionality/features.
  63  *
  64  * @author Neeraj Bajaj SUN Microsystems
  65  * @author K.Venugopal SUN Microsystems
  66  * @author Glenn Marcy, IBM
  67  * @author Andy Clark, IBM
  68  * @author Arnaud  Le Hors, IBM
  69  * @author Eric Ye, IBM
  70  * @author Sunitha Reddy, SUN Microsystems
  71  *
  72  */
  73 public class XMLDocumentFragmentScannerImpl


 158     protected static final String STANDARD_URI_CONFORMANT =
 159             Constants.XERCES_FEATURE_PREFIX +Constants.STANDARD_URI_CONFORMANT_FEATURE;
 160 
 161     /** Property identifier: Security property manager. */
 162     private static final String XML_SECURITY_PROPERTY_MANAGER =
 163             Constants.XML_SECURITY_PROPERTY_MANAGER;
 164 
 165     /** access external dtd: file protocol
 166      *  For DOM/SAX, the secure feature is set to true by default
 167      */
 168     final static String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
 169 
 170     // recognized features and properties
 171 
 172     /** Recognized features. */
 173     private static final String[] RECOGNIZED_FEATURES = {
 174                 NAMESPACES,
 175                 VALIDATION,
 176                 NOTIFY_BUILTIN_REFS,
 177                 NOTIFY_CHAR_REFS,
 178                 Constants.STAX_REPORT_CDATA_EVENT

 179     };
 180 
 181     /** Feature defaults. */
 182     private static final Boolean[] FEATURE_DEFAULTS = {
 183                 Boolean.TRUE,
 184                 null,
 185                 Boolean.FALSE,
 186                 Boolean.FALSE,
 187                 Boolean.TRUE

 188     };
 189 
 190     /** Recognized properties. */
 191     private static final String[] RECOGNIZED_PROPERTIES = {
 192         SYMBOL_TABLE,
 193                 ERROR_REPORTER,
 194                 ENTITY_MANAGER,
 195                 XML_SECURITY_PROPERTY_MANAGER




 196     };
 197 
 198     /** Property defaults. */
 199     private static final Object[] PROPERTY_DEFAULTS = {
 200                 null,
 201                 null,
 202                 null,




 203                 null
 204     };

 205 
 206     private static final char [] cdata = {'[','C','D','A','T','A','['};
 207     static final char [] xmlDecl = {'<','?','x','m','l'};
 208     // private static final char [] endTag = {'<','/'};
 209     // debugging
 210 
 211     /** Debug scanner state. */
 212     private static final boolean DEBUG_SCANNER_STATE = false;
 213 
 214     /** Debug driver. */
 215     private static final boolean DEBUG_DISPATCHER = false;
 216 
 217     /** Debug content driver scanning. */
 218     protected static final boolean DEBUG_START_END_ELEMENT = false;
 219 
 220 
 221     /** Debug driver next */
 222     protected static final boolean DEBUG_NEXT = false ;
 223 
 224     /** Debug driver next */




  31 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  32 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
  33 import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
  34 import com.sun.org.apache.xerces.internal.xni.XMLString;
  35 import com.sun.org.apache.xerces.internal.xni.XNIException;
  36 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
  37 import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
  38 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
  39 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
  40 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
  41 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  42 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
  43 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
  44 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
  45 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
  46 import com.sun.xml.internal.stream.XMLBufferListener;
  47 import com.sun.xml.internal.stream.XMLEntityStorage;
  48 import com.sun.xml.internal.stream.dtd.DTDGrammarUtil;
  49 import java.io.EOFException;
  50 import java.io.IOException;
  51 import javax.xml.XMLConstants;
  52 import javax.xml.stream.XMLInputFactory;
  53 import javax.xml.stream.XMLStreamConstants;
  54 import javax.xml.stream.events.XMLEvent;
  55 import jdk.xml.internal.JdkXmlUtils;
  56 
  57 /**
  58  *
  59  * This class is responsible for scanning the structure and content
  60  * of document fragments.
  61  *
  62  * This class has been modified as per the new design which is more suited to
  63  * efficiently build pull parser. Lot of improvements have been done and
  64  * the code has been added to support stax functionality/features.
  65  *
  66  * @author Neeraj Bajaj SUN Microsystems
  67  * @author K.Venugopal SUN Microsystems
  68  * @author Glenn Marcy, IBM
  69  * @author Andy Clark, IBM
  70  * @author Arnaud  Le Hors, IBM
  71  * @author Eric Ye, IBM
  72  * @author Sunitha Reddy, SUN Microsystems
  73  *
  74  */
  75 public class XMLDocumentFragmentScannerImpl


 160     protected static final String STANDARD_URI_CONFORMANT =
 161             Constants.XERCES_FEATURE_PREFIX +Constants.STANDARD_URI_CONFORMANT_FEATURE;
 162 
 163     /** Property identifier: Security property manager. */
 164     private static final String XML_SECURITY_PROPERTY_MANAGER =
 165             Constants.XML_SECURITY_PROPERTY_MANAGER;
 166 
 167     /** access external dtd: file protocol
 168      *  For DOM/SAX, the secure feature is set to true by default
 169      */
 170     final static String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
 171 
 172     // recognized features and properties
 173 
 174     /** Recognized features. */
 175     private static final String[] RECOGNIZED_FEATURES = {
 176                 NAMESPACES,
 177                 VALIDATION,
 178                 NOTIFY_BUILTIN_REFS,
 179                 NOTIFY_CHAR_REFS,
 180                 Constants.STAX_REPORT_CDATA_EVENT,
 181                 XMLConstants.USE_CATALOG
 182     };
 183 
 184     /** Feature defaults. */
 185     private static final Boolean[] FEATURE_DEFAULTS = {
 186                 Boolean.TRUE,
 187                 null,
 188                 Boolean.FALSE,
 189                 Boolean.FALSE,
 190                 Boolean.TRUE,
 191                 JdkXmlUtils.USE_CATALOG_DEFAULT
 192     };
 193 
 194     /** Recognized properties. */
 195     private static final String[] RECOGNIZED_PROPERTIES = {
 196                 SYMBOL_TABLE,
 197                 ERROR_REPORTER,
 198                 ENTITY_MANAGER,
 199                 XML_SECURITY_PROPERTY_MANAGER,
 200                 JdkXmlUtils.CATALOG_DEFER,
 201                 JdkXmlUtils.CATALOG_FILES,
 202                 JdkXmlUtils.CATALOG_PREFER,
 203                 JdkXmlUtils.CATALOG_RESOLVE
 204     };
 205 
 206     /** Property defaults. */
 207     private static final Object[] PROPERTY_DEFAULTS = {
 208                 null,
 209                 null,
 210                 null,
 211                 null,
 212                 null,
 213                 null,
 214                 null,
 215                 null
 216     };
 217 
 218 
 219     private static final char [] cdata = {'[','C','D','A','T','A','['};
 220     static final char [] xmlDecl = {'<','?','x','m','l'};
 221     // private static final char [] endTag = {'<','/'};
 222     // debugging
 223 
 224     /** Debug scanner state. */
 225     private static final boolean DEBUG_SCANNER_STATE = false;
 226 
 227     /** Debug driver. */
 228     private static final boolean DEBUG_DISPATCHER = false;
 229 
 230     /** Debug content driver scanning. */
 231     protected static final boolean DEBUG_START_END_ELEMENT = false;
 232 
 233 
 234     /** Debug driver next */
 235     protected static final boolean DEBUG_NEXT = false ;
 236 
 237     /** Debug driver next */