< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM.java

Print this page


   1 /*
   2  * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Oct 2017
   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 
  22 package com.sun.org.apache.xml.internal.dtm.ref.sax2dtm;
  23 


  46 import java.util.List;
  47 import java.util.Map;
  48 import java.util.Vector;
  49 import javax.xml.transform.Source;
  50 import javax.xml.transform.SourceLocator;
  51 import org.xml.sax.Attributes;
  52 import org.xml.sax.ContentHandler;
  53 import org.xml.sax.DTDHandler;
  54 import org.xml.sax.EntityResolver;
  55 import org.xml.sax.ErrorHandler;
  56 import org.xml.sax.InputSource;
  57 import org.xml.sax.Locator;
  58 import org.xml.sax.SAXException;
  59 import org.xml.sax.SAXParseException;
  60 import org.xml.sax.ext.DeclHandler;
  61 import org.xml.sax.ext.LexicalHandler;
  62 
  63 /**
  64  * This class implements a DTM that tends to be optimized more for speed than
  65  * for compactness, that is constructed via SAX2 ContentHandler events.


  66  */
  67 public class SAX2DTM extends DTMDefaultBaseIterators
  68         implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler,
  69                    DeclHandler, LexicalHandler
  70 {
  71   /** Set true to monitor SAX events and similar diagnostic info. */
  72   private static final boolean DEBUG = false;
  73 
  74   /**
  75    * If we're building the model incrementally on demand, we need to
  76    * be able to tell the source when to send us more data.
  77    *
  78    * Note that if this has not been set, and you attempt to read ahead
  79    * of the current build point, we'll probably throw a null-pointer
  80    * exception. We could try to wait-and-retry instead, as a very poor
  81    * fallback, but that has all the known problems with multithreading
  82    * on multiprocessors and we Don't Want to Go There.
  83    *
  84    * @see setIncrementalSAXSource
  85    */


   1 /*
   2  * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  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.xml.internal.dtm.ref.sax2dtm;
  22 


  45 import java.util.List;
  46 import java.util.Map;
  47 import java.util.Vector;
  48 import javax.xml.transform.Source;
  49 import javax.xml.transform.SourceLocator;
  50 import org.xml.sax.Attributes;
  51 import org.xml.sax.ContentHandler;
  52 import org.xml.sax.DTDHandler;
  53 import org.xml.sax.EntityResolver;
  54 import org.xml.sax.ErrorHandler;
  55 import org.xml.sax.InputSource;
  56 import org.xml.sax.Locator;
  57 import org.xml.sax.SAXException;
  58 import org.xml.sax.SAXParseException;
  59 import org.xml.sax.ext.DeclHandler;
  60 import org.xml.sax.ext.LexicalHandler;
  61 
  62 /**
  63  * This class implements a DTM that tends to be optimized more for speed than
  64  * for compactness, that is constructed via SAX2 ContentHandler events.
  65  *
  66  * @LastModified: Oct 2017
  67  */
  68 public class SAX2DTM extends DTMDefaultBaseIterators
  69         implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler,
  70                    DeclHandler, LexicalHandler
  71 {
  72   /** Set true to monitor SAX events and similar diagnostic info. */
  73   private static final boolean DEBUG = false;
  74 
  75   /**
  76    * If we're building the model incrementally on demand, we need to
  77    * be able to tell the source when to send us more data.
  78    *
  79    * Note that if this has not been set, and you attempt to read ahead
  80    * of the current build point, we'll probably throw a null-pointer
  81    * exception. We could try to wait-and-retry instead, as a very poor
  82    * fallback, but that has all the known problems with multithreading
  83    * on multiprocessors and we Don't Want to Go There.
  84    *
  85    * @see setIncrementalSAXSource
  86    */


< prev index next >