You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2002/11/14 19:57:24 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerFactoryImpl.java TransformerHandlerImpl.java TransformerImpl.java

zongaro     2002/11/14 10:57:24

  Modified:    java/src/org/apache/xalan/xslt Tag: XSLTC_DTM Process.java
               java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        DOMAdapter.java DOMImpl.java SAXImpl.java
               java/src/org/apache/xalan/xsltc/runtime Tag: XSLTC_DTM
                        AttributeList.java
               java/src/org/apache/xalan/xsltc/trax Tag: XSLTC_DTM
                        TransformerFactoryImpl.java
                        TransformerHandlerImpl.java TransformerImpl.java
  Added:       java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        DOMWSFilter.java
  Log:
  Checking in Morris Kwan's (mkwan@ca.ibm.com) changes to wrap an XSLTC
  StripFilter in a DTMWSFilter.  This gives a significant performance boost in
  building a SAXImpl or DOMImpl object.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.47.6.4  +3 -6      xml-xalan/java/src/org/apache/xalan/xslt/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xslt/Process.java,v
  retrieving revision 1.47.6.3
  retrieving revision 1.47.6.4
  diff -u -r1.47.6.3 -r1.47.6.4
  --- Process.java	4 Oct 2002 09:24:46 -0000	1.47.6.3
  +++ Process.java	14 Nov 2002 18:57:22 -0000	1.47.6.4
  @@ -558,12 +558,9 @@
           }
           else if ("-INCREMENTAL".equalsIgnoreCase(argv[i]))
           {
  -          if (!useXSLTC)
  -            tfactory.setAttribute
  -              ("http://xml.apache.org/xalan/features/incremental", 
  -               java.lang.Boolean.TRUE);
  -          else
  -            printInvalidXSLTCOption("-INCREMENTAL");
  +          tfactory.setAttribute
  +            ("http://xml.apache.org/xalan/features/incremental", 
  +             java.lang.Boolean.TRUE);
           }
           else if ("-NOOPTIMIZE".equalsIgnoreCase(argv[i]))
           {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.11.10.9 +11 -1     xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java
  
  Index: DOMAdapter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java,v
  retrieving revision 1.11.10.8
  retrieving revision 1.11.10.9
  diff -u -r1.11.10.8 -r1.11.10.9
  --- DOMAdapter.java	13 Nov 2002 17:03:22 -0000	1.11.10.8
  +++ DOMAdapter.java	14 Nov 2002 18:57:22 -0000	1.11.10.9
  @@ -121,7 +121,9 @@
       }
   
       private short[] getMapping() {
  -	if (_mapping == null) {
  +	if (_mapping == null 
  +	    || (_saxImpl != null && _saxImpl.getNamesArray() == null)
  +	    || (_domImpl != null && _domImpl.getNamesArray() == null)) {
               if (_domImpl != null) {
   	        _mapping = _domImpl.getMapping(_namesArray);
               } else {
  @@ -179,6 +181,7 @@
       
       public DTMAxisIterator getChildren(final int node) {
           DTMAxisIterator iterator = _dom.getChildren(node);
  +        /*
           if (_filter != null) {
               if (_domImpl != null)
                   iterator = _domImpl.strippingIterator(iterator, getMapping(),
  @@ -187,6 +190,7 @@
                   iterator = _saxImpl.strippingIterator(iterator, getMapping(),
                                                         _filter);
           }
  +        */
           return iterator.setStartNode(node);
       }
   
  @@ -198,6 +202,7 @@
         final int[] reverse = getReverse();
   
         DTMAxisIterator iterator = _dom.getTypedChildren(reverse[type]);
  +      /*
         if (_filter != null && reverse[type] == DTM.TEXT_NODE) {
         	if (_domImpl != null) {
             iterator = _domImpl.strippingIterator(iterator,getMapping(),_filter);
  @@ -205,6 +210,7 @@
             iterator = _saxImpl.strippingIterator(iterator,getMapping(),_filter);
           }
         }
  +      */
         return iterator;
       }
   
  @@ -215,12 +221,14 @@
   
       public DTMAxisIterator getAxisIterator(final int axis) {
         DTMAxisIterator iterator = _dom.getAxisIterator(axis);
  +      /*
         if (_filter != null)
         {
           return (_domImpl != null)
                     ? _domImpl.strippingIterator(iterator, getMapping(), _filter)
                     : _saxImpl.strippingIterator(iterator, getMapping(), _filter);
         }
  +      */
         return iterator;
       }
       
  @@ -240,12 +248,14 @@
             iterator = _dom.getTypedAxisIterator(axis, reverse[type]);
         }
         
  +      /*
         if (_filter != null && reverse[type] == DTM.TEXT_NODE) {
         	iterator = (_domImpl != null)
                       ? _domImpl.strippingIterator(iterator,getMapping(),_filter)
                       : _saxImpl.strippingIterator(iterator,getMapping(),_filter);
           
         }
  +      */
         return iterator;
       }
       
  
  
  
  1.68.2.17 +61 -30    xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
  
  Index: DOMImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
  retrieving revision 1.68.2.16
  retrieving revision 1.68.2.17
  diff -u -r1.68.2.16 -r1.68.2.17
  --- DOMImpl.java	13 Nov 2002 17:03:48 -0000	1.68.2.16
  +++ DOMImpl.java	14 Nov 2002 18:57:22 -0000	1.68.2.17
  @@ -143,12 +143,12 @@
       private int       _URICount = 0;
   
       // Tracks which textnodes are whitespaces and which are not
  -    private BitArray  _whitespace; // takes xml:space into acc.
  +    // private BitArray  _whitespace; // takes xml:space into acc.
       // Tracks which bits in _whitespace are valid
  -    private BitArray _checkedForWhitespace;
  +    // private BitArray _checkedForWhitespace;
   
       // Tracks which textnodes are not escaped
  -    private BitArray  _dontEscape = null; 
  +    private BitArray  _dontEscape = null;
   
       // The URI to this document
       private String    _documentURI = null;
  @@ -185,7 +185,7 @@
           Integer eType = new Integer(getExpandedTypeID(EMPTYSTRING, EMPTYSTRING,
                                                         DTM.NAMESPACE_NODE));
           _nsIndex.put(eType, new Integer(_URICount++));
  -  
  +        
           eType = new Integer(getExpandedTypeID(XML_PREFIX,
                                        "http://www.w3.org/XML/1998/namespace",
                                        DTM.NAMESPACE_NODE));
  @@ -562,7 +562,7 @@
        * nodes from the underlaying iterator and return all but
        * whitespace text nodes. The iterator needs to be a supplied
        * with a filter that tells it what nodes are WS text.
  -     */             
  +                  
       private final class StrippingIterator extends InternalAxisIteratorBase {
   
           private static final int USE_PREDICATE  = 0;
  @@ -703,13 +703,16 @@
           }
   
       } // end of StrippingIterator
  +    */
   
  +    /*
       public DTMAxisIterator strippingIterator(DTMAxisIterator iterator,
                                             short[] mapping,
                                             StripFilter filter) 
       {
         return(new StrippingIterator(iterator, mapping, filter));
       }
  +    */
   
       /**************************************************************
        * This is a specialised iterator for predicates comparing node or
  @@ -965,27 +968,43 @@
        * Get mapping from DOM element/attribute types to external types
        */
       public short[] getMapping(String[] names) {
  -        int i;
  -        final int namesLength = names.length;
  -        final int exLength = m_expandedNameTable.getSize();
  -        final short[] result = new short[exLength];
  -
  -        // primitive types map to themselves
  -        for (i = 0; i < DTM.NTYPES; i++)
  -            result[i] = (short)i;
  +      int i;
  +      final int namesLength = names.length;
  +      final int exLength = m_expandedNameTable.getSize();
  +      int[] generalizedTypes = null;
  +      if (namesLength > 0)
  +          generalizedTypes = new int[namesLength];
  +      
  +      int resultLength = exLength;
  +      
  +      for (i = 0; i < namesLength; i++) {
  +          generalizedTypes[i] = getGeneralizedType(names[i]);
  +          if (_types == null && generalizedTypes[i] >= resultLength)
  +              resultLength = generalizedTypes[i] + 1;
  +      }
  +      
  +      final short[] result = new short[resultLength];
  +
  +      // primitive types map to themselves
  +      for (i = 0; i < DTM.NTYPES; i++)
  +        result[i] = (short)i;
           
  -        for (i = NTYPES; i < exLength; i++) 
  -            result[i] = m_expandedNameTable.getType(i); 
  +      for (i = NTYPES; i < exLength; i++) 
  +      	result[i] = m_expandedNameTable.getType(i); 
         	
  -        // actual mapping of caller requested names
  -        for (i = 0; i < namesLength; i++) {
  -            int genType = getGeneralizedType(names[i]);
  -            if (genType < _types.length && genType == _types[genType]) {
  -                result[genType] = (short)(i + DTM.NTYPES);
  -            }
  -        }
  +      // actual mapping of caller requested names
  +      for (i = 0; i < namesLength; i++) {
  +          int genType = generalizedTypes[i];          
  +          if (_types != null) {
  +              if (genType < _types.length && genType == _types[genType]) {
  +                  result[genType] = (short)(i + DTM.NTYPES);
  +              }
  +          }
  +          else
  +              result[genType] = (short)(i + DTM.NTYPES);          
  +      }
   
  -        return result;
  +      return result;
       }
   
       /**
  @@ -1081,7 +1100,7 @@
         out.writeObject(_uriArray);        // name of all URIs
         out.writeObject(_prefixArray);     // name of all prefixes
   
  -      out.writeObject(_whitespace);
  +      //out.writeObject(_whitespace);
   
   
   	if (_dontEscape != null) {
  @@ -1119,7 +1138,7 @@
         _uriArray      = (String[])in.readObject();
         _prefixArray   = (Hashtable)in.readObject();
   
  -      _whitespace    = (BitArray)in.readObject();
  +      //_whitespace    = (BitArray)in.readObject();
   
   
   	_dontEscape    = (BitArray)in.readObject();
  @@ -1192,8 +1211,8 @@
         _offsetOrChild        = new int[size];
         _lengthOrAttr         = new int[size];
         _text                 = new char[textsize];
  -      _whitespace           = new BitArray(size);
  -      _checkedForWhitespace = new BitArray(size);
  +      //_whitespace           = new BitArray(size);
  +      //_checkedForWhitespace = new BitArray(size);
       }
   
       /**
  @@ -1911,6 +1930,14 @@
       }
   
       /**
  +     * Return the names array
  +     */
  +    public String[] getNamesArray()
  +    {
  +        return _namesArray;
  +    }
  +
  +    /**
        * Returns true if a character is an XML whitespace character.
        * Order of tests is important for performance ([space] first).
        */
  @@ -2164,6 +2191,8 @@
            */
           private int makeTextNode(boolean isWhitespace) {
               final int node = getNumberOfNodes()-1;
  +            
  +            /*
               // Tag as whitespace node if the parser tells us that it is...
               if (isWhitespace)
               {
  @@ -2183,7 +2212,9 @@
                       }
                   }
               }
  -            storeTextRef(node);
  +            */
  +            
  +            // storeTextRef(node);
               return node;
           }
   
  @@ -2437,7 +2468,7 @@
   	    characters(target);
   	    characters(" ");
   	    characters(data);
  -	    storeTextRef(node);
  +	    // storeTextRef(node);
   	}
   
   	/**
  @@ -2600,7 +2631,7 @@
               _lengthOrAttr = newLengthOrAttr;
   
               // Resize the '_whitespace' array (a BitArray instance)
  -            _whitespace.resize(newSize);
  +            // _whitespace.resize(newSize);
   
           }
     
  
  
  
  1.1.2.20  +102 -78   xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/SAXImpl.java
  
  Index: SAXImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/SAXImpl.java,v
  retrieving revision 1.1.2.19
  retrieving revision 1.1.2.20
  diff -u -r1.1.2.19 -r1.1.2.20
  --- SAXImpl.java	13 Nov 2002 17:03:54 -0000	1.1.2.19
  +++ SAXImpl.java	14 Nov 2002 18:57:23 -0000	1.1.2.20
  @@ -100,7 +100,6 @@
       private int       _parentStackLength    = INIT_STACK_LENGTH;
       private int[]     _parentStack          = new int[INIT_STACK_LENGTH];
       private int       _sp;
  -    private int       _currentNode          = 0;
   
       // Temporary structures for attribute nodes
       private int       _currentAttributeNode = 1;
  @@ -123,6 +122,7 @@
   
       private boolean _escaping = true;
       private boolean _disableEscaping = false;
  +    private int _textNodeToProcess = DTM.NULL;
   
       /* ------------------------------------------------------------------- */
       /* DOMBuilder fields END                                               */
  @@ -157,8 +157,11 @@
       private Hashtable _nsIndex = new Hashtable();
   
       // Tracks which textnodes are whitespaces and which are not
  -    private BitArray  _whitespace; // takes xml:space into acc.
  +    //private BitArray  _whitespace; // takes xml:space into acc.
      
  +    // The initial size of the text buffer
  +    private int _size = 0;
  +    
       // Tracks which textnodes are not escaped
       private BitArray  _dontEscape = null;
   
  @@ -443,7 +446,7 @@
        * nodes from the underlaying iterator and return all but
        * whitespace text nodes. The iterator needs to be a supplied
        * with a filter that tells it what nodes are WS text.
  -     */
  +     *
       private final class StrippingIterator extends InternalAxisIteratorBase {
   
   	private static final int USE_PREDICATE  = 0;
  @@ -570,13 +573,15 @@
     }
   
   } // end of StrippingIterator
  -
  +*/
  +    /*
       public DTMAxisIterator strippingIterator(DTMAxisIterator iterator,
                                             short[] mapping,
                                             StripFilter filter)
       {
         return(new StrippingIterator(iterator, mapping, filter));
       }
  +    */
   
       /**************************************************************
        * This is a specialised iterator for predicates comparing node or
  @@ -902,9 +907,20 @@
       {
         int i;
         final int namesLength = names.length;
  -      final int mappingLength = _namesArray.length + NTYPES;
         final int exLength = m_expandedNameTable.getSize();
  -      final short[] result = new short[exLength];
  +      int[] generalizedTypes = null;
  +      if (namesLength > 0)
  +          generalizedTypes = new int[namesLength];
  +      
  +      int resultLength = exLength;
  +      
  +      for (i = 0; i < namesLength; i++) {
  +          generalizedTypes[i] = getGeneralizedType(names[i]);
  +          if (_types == null && generalizedTypes[i] >= resultLength)
  +              resultLength = generalizedTypes[i] + 1;
  +      }
  +      
  +      final short[] result = new short[resultLength];
   
         // primitive types map to themselves
         for (i = 0; i < DTM.NTYPES; i++)
  @@ -915,10 +931,14 @@
         	
         // actual mapping of caller requested names
         for (i = 0; i < namesLength; i++) {
  -          int genType = getGeneralizedType(names[i]);
  -          if (genType < _types.length && genType == _types[genType]) {
  -              result[genType] = (short)(i + DTM.NTYPES);
  +          int genType = generalizedTypes[i];         
  +          if (_types != null) {
  +              if (genType < _types.length && genType == _types[genType]) {
  +                  result[genType] = (short)(i + DTM.NTYPES);
  +              }
             }
  +          else
  +              result[genType] = (short)(i + DTM.NTYPES);         
         }
   
         return(result);
  @@ -1031,8 +1051,9 @@
       {
         super(mgr, saxSource, dtmIdentity, whiteSpaceFilter, xstringfactory,
               doIndexing);
  -      initialize(size, size < 128 ? SMALL_TEXT_SIZE
  -                                  : size * DEFAULT_TEXT_FACTOR);
  +      _size = size;
  +      //initialize(size, size < 128 ? SMALL_TEXT_SIZE
  +      //                            : size * DEFAULT_TEXT_FACTOR);
                                     
          /* From DOMBuilder */ 
         _xmlSpaceStack[0] = DTMDefaultBase.ROOTNODE;                            
  @@ -1040,11 +1061,12 @@
   
       /**
        *  defines initial size
  -     */
  +     
       private void initialize(int size, int textsize)
       {
         _whitespace           = new BitArray(size);
       }
  +    */
   
      /*---------------------------------------------------------------------------*/
      /* DOMBuilder methods begin                                                  */
  @@ -1076,6 +1098,20 @@
       }
     }
   
  +  /**
  +   * Find out whether or not to strip whitespace nodes.
  +   *
  +   *
  +   * @return whether or not to strip whitespace nodes.
  +   */
  +  protected boolean getShouldStripWhitespace()
  +  {
  +      if (_preserve)
  +          return false;
  +      else
  +          return super.getShouldStripWhitespace(); 
  +  }
  +
       /**
        * Returns the next available node. Increases the various arrays
        * that constitute the node if necessary.
  @@ -1121,34 +1157,17 @@
       /**
        * Creates a text-node and checks if it is a whitespace node.
      */
  -  private int makeTextNode(boolean isWhitespace)
  -  {
  -      final int node = getNumberOfNodes()-1; //nextNode();
  -      
  -      // Tag as whitespace node if the parser tells us that it is...
  -      if (isWhitespace) {      
  -        _whitespace.setBit(node);
  -        _currentNode = node;   // Catch up?? ILENE
  -        
  -      // ...otherwise we check if this is a whitespace node, unless
  -      // the node is protected by an xml:space="preserve" attribute.
  -      } else if (!_preserve) {
  -           while (_currentNode < node) {
  -              int nodeh = makeNodeHandle(++_currentNode);
  -              if (isWhitespace(nodeh)) { 
  -                  _whitespace.setBit(_currentNode);
  -              }
  -           }
  -      }
  -      
  -      if (_disableEscaping) {
  +  private void handleTextEscaping() {
  +      if (_disableEscaping && _textNodeToProcess != DTM.NULL
  +            && getNodeType(makeNodeHandle(_textNodeToProcess))==DTM.TEXT_NODE) {
             if (_dontEscape == null) {
  -              _dontEscape = new BitArray(_whitespace.size());
  +              //_dontEscape = new BitArray(_whitespace.size());
  +              _dontEscape = new BitArray(_size);
             }
  -          _dontEscape.setBit(_currentNode);
  +          _dontEscape.setBit(_textNodeToProcess);
             _disableEscaping = false;
         }
  -      return node;
  +      _textNodeToProcess = DTM.NULL;
     }
   
       private int makeNamespaceNode(String prefix, String uri)
  @@ -1174,7 +1193,7 @@
          super.characters(ch, start, length);
           
          _disableEscaping = !_escaping;  
  -
  +       _textNodeToProcess = getNumberOfNodes();
     }
   
       /**
  @@ -1186,7 +1205,6 @@
           super.startDocument();
           _sp             = 0;
           _parentStack[0] = DTMDefaultBase.ROOTNODE;  // root
  -        _currentNode    = DTMDefaultBase.ROOTNODE + 1;
           _currentAttributeNode = 1;
   
           definePrefixAndUri(EMPTYSTRING, EMPTYSTRING);
  @@ -1198,9 +1216,6 @@
        */
       public void endDocument() throws SAXException
     {
  -
  -     makeTextNode(false);
  -
       final int namesSize = m_expandedNameTable.getSize() - DTM.NTYPES;
       _types = new int[m_expandedNameTable.getSize()];
    
  @@ -1235,14 +1250,16 @@
       // trim arrays' sizes
       //resizeTextArray(_currentOffset);
   
  -    _firstAttributeNode = _currentNode;
  +    _firstAttributeNode = getNumberOfNodes()-1;
      // shiftAttributes(_currentNode);
  -    resizeArrays(_currentNode + _currentAttributeNode, _currentNode);
  +    resizeArrays(_firstAttributeNode + _currentAttributeNode,
  +                 _firstAttributeNode);
      // appendAttributes();
       //_treeNodeLimit = _currentNode + _currentAttributeNode;
   
   
           super.endDocument();
  +     handleTextEscaping();
     }
   
       /**
  @@ -1251,31 +1268,33 @@
       public void startElement(String uri, String localName,
                    String qname, Attributes attributes)
           throws SAXException
  -  {
  -     super.startElement(uri, localName, qname, attributes);
  +    {
  +        super.startElement(uri, localName, qname, attributes);
  +        handleTextEscaping();
   
  -    // Get node index and setup parent/child references
  -    final int node = makeTextNode(false); //nextNode();
  -    linkParent(node);
  -
  -    // Look for any xml:space attributes
  -    // Depending on the implementation of attributes, this
  -    // might be faster than looping through all attributes. ILENE
  -    final int index = attributes.getIndex(XMLSPACE_STRING);
  -    if (index > 0) {
  -        xmlSpaceDefine(attributes.getValue(index), node);
  +        // Get node index and setup parent/child references
  +        int currentNode = getNumberOfNodes()-1;
  +        linkParent(currentNode);
  +
  +        if (m_wsfilter != null) {
  +            // Look for any xml:space attributes
  +            // Depending on the implementation of attributes, this
  +            // might be faster than looping through all attributes. ILENE
  +            final int index = attributes.getIndex(XMLSPACE_STRING);
  +            if (index >= 0) {
  +                xmlSpaceDefine(attributes.getValue(index), currentNode);
  +            }
  +        }
       }
  -  }
   
       /**
        * SAX2: Receive notification of the end of an element.
        */
       public void endElement(String namespaceURI, String localName,
                      String qname) throws SAXException
  -        {
  +    {
           super.endElement(namespaceURI, localName, qname);
  -
  -      makeTextNode(false);
  +        handleTextEscaping();
   
           // Revert to strip/preserve-space setting from before this element
               // use m_parent??
  @@ -1287,9 +1306,9 @@
        */
       public void processingInstruction(String target, String data)
           throws SAXException
  -        {
  +    {
           super.processingInstruction(target, data);
  -        makeTextNode(false);
  +        handleTextEscaping();
       }
   
       /**
  @@ -1298,23 +1317,23 @@
        */
       public void ignorableWhitespace(char[] ch, int start, int length)
               throws SAXException
  -        {
  -            super.ignorableWhitespace(ch, start, length);
  -            makeTextNode(true);
  -        }
  +    {
  +        super.ignorableWhitespace(ch, start, length);
  +        _textNodeToProcess = getNumberOfNodes();
  +    }
   
       /**
        * SAX2: Begin the scope of a prefix-URI Namespace mapping.
        */
       public void startPrefixMapping(String prefix, String uri)
           throws SAXException
  -        {
  -            super.startPrefixMapping(prefix, uri);
  -            definePrefixAndUri(prefix, uri);
  +    {
  +        super.startPrefixMapping(prefix, uri);
  +        handleTextEscaping();
   
  -            makeTextNode(false);
  -            makeNamespaceNode(prefix, uri);
  -        }
  +        definePrefixAndUri(prefix, uri);
  +        makeNamespaceNode(prefix, uri);
  +    }
   
       private void definePrefixAndUri(String prefix, String uri) 
           throws SAXException 
  @@ -1333,11 +1352,8 @@
       public void comment(char[] ch, int start, int length)
               throws SAXException
           {
  -            // Why do we need to call makeTextNode twice.  Second
  -            // call should cover both
  -        //   makeTextNode(false); 
               super.comment(ch, start, length);
  -            makeTextNode(false);
  +            handleTextEscaping();
           }
   
       /**
  @@ -1352,11 +1368,11 @@
           }
   
       private void resizeArrays(final int newSize, int length) {
  -    if ((length < newSize) && (newSize == _currentNode))
  -      length = _currentNode;
  +    if ((length < newSize) && (newSize == getNumberOfNodes()-1))
  +      length = getNumberOfNodes()-1;
   
       // Resize the '_whitespace' array (a BitArray instance)
  -    _whitespace.resize(newSize);
  +    // _whitespace.resize(newSize);
       // Resize the '_dontEscape' array (a BitArray instance)
       if (_dontEscape != null) {
           _dontEscape.resize(newSize);
  @@ -2022,6 +2038,14 @@
       public DOMBuilder getBuilder()
       {
   	return this;
  +    }
  +    
  +    /**
  +     * Return the names array
  +     */
  +    public String[] getNamesArray()
  +    {
  +        return _namesArray;
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +139 -0    xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/DOMWSFilter.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.14.1  +3 -3      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AttributeList.java
  
  Index: AttributeList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AttributeList.java,v
  retrieving revision 1.4
  retrieving revision 1.4.14.1
  diff -u -r1.4 -r1.4.14.1
  --- AttributeList.java	6 Jun 2001 07:41:56 -0000	1.4
  +++ AttributeList.java	14 Nov 2002 18:57:23 -0000	1.4.14.1
  @@ -153,14 +153,14 @@
        * SAX2: Look up the index of an attribute by Namespace name.
        */
       public int getIndex(String namespaceURI, String localPart) {
  -	return(0);
  +	return(-1);
       }
   
       /**
        * SAX2: Look up the index of an attribute by XML 1.0 qualified name.
        */
       public int getIndex(String qname) {
  -	return(0);
  +	return(-1);
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.34.2.9  +22 -1     xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.34.2.8
  retrieving revision 1.34.2.9
  diff -u -r1.34.2.8 -r1.34.2.9
  --- TransformerFactoryImpl.java	5 Nov 2002 10:41:47 -0000	1.34.2.8
  +++ TransformerFactoryImpl.java	14 Nov 2002 18:57:23 -0000	1.34.2.9
  @@ -198,6 +198,14 @@
       private boolean _autoTranslet = false;
   
       /**
  +     * The name of the feature for incremental building of the DTM.
     */
  +    public static String FEATURE_INCREMENTAL = "http://xml.apache.org/xalan/features/incremental";
  +    
  +    /**
  +     *  Set to <code>true</code> when we want to use incremental building of the DTM.
     */
  +    protected boolean _incremental = false;
  +    
  +    /**
        * Number of indent spaces when indentation is turned on.
        */
       private int _indentNumber = -1;
  @@ -265,6 +273,9 @@
   	else if (name.equals("auto-translet")) {
   	    return new Boolean(_autoTranslet);
   	}
  +	else if (name.equals(FEATURE_INCREMENTAL)) {
  +	    return new Boolean(_incremental);	
  +	}
   
   	// Throw an exception for all other attributes
   	ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
  @@ -337,6 +348,16 @@
   	    }
   	    else if (value instanceof String) {
   		_enableInlining = ((String) value).equalsIgnoreCase("true");
  +		return;
  +	    }
  +	}
  +	else if (name.equals(FEATURE_INCREMENTAL)) {
  +	    if (value instanceof Boolean) {
  +		_incremental = ((Boolean) value).booleanValue();
  +		return;
  +	    }
  +	    else if (value instanceof String) {
  +		_incremental = ((String) value).equalsIgnoreCase("true");
   		return;
   	    }
   	}
  
  
  
  1.6.10.9  +11 -1     xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerHandlerImpl.java
  
  Index: TransformerHandlerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerHandlerImpl.java,v
  retrieving revision 1.6.10.8
  retrieving revision 1.6.10.9
  diff -u -r1.6.10.8 -r1.6.10.9
  --- TransformerHandlerImpl.java	13 Nov 2002 17:03:05 -0000	1.6.10.8
  +++ TransformerHandlerImpl.java	14 Nov 2002 18:57:23 -0000	1.6.10.9
  @@ -72,13 +72,16 @@
   import javax.xml.transform.stream.StreamSource;
   
   import org.apache.xml.dtm.DTMManager;
  +import org.apache.xml.dtm.DTMWSFilter;
   
   import org.apache.xalan.xsltc.Translet;
   import org.apache.xalan.xsltc.TransletOutputHandler;
  +import org.apache.xalan.xsltc.StripFilter;
   import org.apache.xalan.xsltc.dom.DOMImpl;
   import org.apache.xalan.xsltc.dom.SAXImpl;
   import org.apache.xalan.xsltc.dom.DOMBuilder;
   import org.apache.xalan.xsltc.dom.XSLTCDTMManager;
  +import org.apache.xalan.xsltc.dom.DOMWSFilter;
   import org.apache.xalan.xsltc.runtime.AbstractTranslet;
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   
  @@ -218,8 +221,15 @@
               DTMManager dtmManager = XSLTCDTMManager.newInstance(
                    org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
   
  +            DTMWSFilter wsFilter;
  +            if (_translet != null && _translet instanceof StripFilter) {
  +                wsFilter = new DOMWSFilter(_translet);
  +            } else {
  +                wsFilter = null;
  +            }
               // Construct the DTM using the SAX events that come through
  -            _dom = (SAXImpl)dtmManager.getDTM(null, false, null, true, false);
  +            _dom = (SAXImpl)dtmManager.getDTM(null, false, wsFilter, true,
  +                                              false);
   	    _handler = _dom.getBuilder();
   	    _lexHandler = (LexicalHandler) _handler;
   	    _dtdHandler = (DTDHandler) _handler;
  
  
  
  1.37.2.11 +23 -5     xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java,v
  retrieving revision 1.37.2.10
  retrieving revision 1.37.2.11
  diff -u -r1.37.2.10 -r1.37.2.11
  --- TransformerImpl.java	13 Nov 2002 17:03:01 -0000	1.37.2.10
  +++ TransformerImpl.java	14 Nov 2002 18:57:24 -0000	1.37.2.11
  @@ -92,6 +92,7 @@
   import org.apache.xalan.xsltc.Translet;
   import org.apache.xalan.xsltc.TransletException;
   import org.apache.xalan.xsltc.TransletOutputHandler;
  +import org.apache.xalan.xsltc.StripFilter;
   import org.apache.xalan.xsltc.DOMCache;
   import org.apache.xalan.xsltc.DOM;
   import org.apache.xalan.xsltc.dom.*;
  @@ -101,12 +102,14 @@
   import org.apache.xalan.xsltc.compiler.*;
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   
  +import org.apache.xml.dtm.DTM;
   import org.apache.xml.dtm.DTMManager;
  +import org.apache.xml.dtm.DTMWSFilter;
   
   import java.util.Properties;
   
   public final class TransformerImpl extends Transformer
  -    implements DOMCache, ErrorListener 
  +    implements DOMCache, ErrorListener
   {
       private final static String EMPTY_STRING = "";
       private final static String NO_STRING    = "no";
  @@ -173,6 +176,10 @@
        * object belongs to.
        */
       private TransformerFactoryImpl _tfactory = null;
  +    
  +    /**
  +     * A flag indicating whether we use incremental building of the DTM.
     */
  +    private boolean _isIncremental = false;
   
       /**
        * A flag indicating whether this transformer implements the identity 
  @@ -203,6 +210,7 @@
   	_propertiesClone = (Properties) _properties.clone();
   	_indentNumber = indentNumber;
   	_tfactory = tfactory;
  +	_isIncremental = tfactory._incremental;
       }
   
       /**
  @@ -386,6 +394,12 @@
   	throws TransformerException {
   	try {
   	    DOM dom = null;
  +	    DTMWSFilter wsfilter;
  +	    if (_translet != null && _translet instanceof StripFilter) {
  +	        wsfilter = new DOMWSFilter(_translet);
  +            } else {
  +	        wsfilter = null;
  +            }
   
   	    // Get systemId from source
   	    if (source != null) {
  @@ -411,7 +425,8 @@
                                      org.apache.xpath.objects.XMLStringFactoryImpl
                                                          .getFactory());
   
  -		dom = (SAXImpl)dtmManager.getDTM(sax, false, null, true, false,
  +                dtmManager.setIncremental(_isIncremental);
  +		dom = (SAXImpl)dtmManager.getDTM(sax, false, wsfilter, true, false,
                                                    hasUserReader);
   		final DOMBuilder builder = ((SAXImpl)dom).getBuilder();
   		try {
  @@ -433,7 +448,8 @@
                                      org.apache.xpath.objects.XMLStringFactoryImpl
                                                            .getFactory());
       
  -		dom = (DOMImpl)dtmManager.getDTM(domsrc, false, null, true,
  +                dtmManager.setIncremental(_isIncremental);
  +		dom = (DOMImpl)dtmManager.getDTM(domsrc, false, wsfilter, true,
                                                    false, false);
   		((DOMImpl)dom).setDocumentURI(_sourceSystemId);
   	    }
  @@ -452,6 +468,8 @@
                                      org.apache.xpath.objects.XMLStringFactoryImpl
                                                      .getFactory());
   
  +		dtmManager.setIncremental(_isIncremental);
  +		
   		InputSource input;
   		if (streamInput != null) {
   		    input = new InputSource(streamInput);
  @@ -468,7 +486,7 @@
   		    throw new TransformerException(err.toString());
   		}
   		dom = (SAXImpl)dtmManager.getDTM(new SAXSource(reader, input),
  -                                                 false, null, true, false,
  +                                                 false, wsfilter, true, false,
                                                    false);
   		((SAXImpl)dom).setDocumentURI(_sourceSystemId);
   	    }
  @@ -1072,7 +1090,7 @@
   	    return(null);
   	}
       }
  -
  +    
       /**
        * Receive notification of a recoverable error. 
        * The transformer must continue to provide normal parsing events after
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org