You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/10/05 11:47:56 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom DOMAdapter.java DOMImpl.java FilterIterator.java MultiDOM.java NthIterator.java StepIterator.java

morten      01/10/05 02:47:56

  Modified:    java/src/org/apache/xalan/xsltc DOM.java
               java/src/org/apache/xalan/xsltc/compiler ApplyTemplates.java
                        FilterParentPath.java ParentLocationPath.java
                        Step.java xpath.cup
               java/src/org/apache/xalan/xsltc/dom DOMAdapter.java
                        DOMImpl.java FilterIterator.java MultiDOM.java
                        NthIterator.java StepIterator.java
  Log:
  Fix for the abbreviated descendant axis in combination with the child axis.
  The problem with this combination manifested itself in test axis82 and
  Sun's tests zv038. This bug was a regression introduced after other fixes
  to the // and descendant iterators.
  PR:		bugzilla 3313
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.6       +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java
  
  Index: DOM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DOM.java	2001/09/21 11:55:55	1.5
  +++ DOM.java	2001/10/05 09:47:55	1.6
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOM.java,v 1.5 2001/09/21 11:55:55 morten Exp $
  + * @(#)$Id: DOM.java,v 1.6 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -97,7 +97,7 @@
       public NodeIterator getTypedChildren(final int type);
       public NodeIterator getAxisIterator(final int axis);
       public NodeIterator getTypedAxisIterator(final int axis, final int type);
  -    public NodeIterator getNthDescendant(int node, int n);
  +    public NodeIterator getNthDescendant(int node, int n, boolean includeself);
       public NodeIterator getNamespaceAxisIterator(final int axis, final int ns);
       public NodeIterator getNodeValueIterator(NodeIterator iter, int returnType,
   					     String value, boolean op);
  
  
  
  1.7       +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyTemplates.java
  
  Index: ApplyTemplates.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ApplyTemplates.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ApplyTemplates.java	2001/08/27 09:07:19	1.6
  +++ ApplyTemplates.java	2001/10/05 09:47:55	1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ApplyTemplates.java,v 1.6 2001/08/27 09:07:19 morten Exp $
  + * @(#)$Id: ApplyTemplates.java,v 1.7 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -155,7 +155,7 @@
   		sortObjects.addElement(child);
   	    }
   	}
  -	
  +
   	// Push a new parameter frame
   	if (stylesheet.hasLocalParams()) {
   	    il.append(classGen.loadTranslet());
  
  
  
  1.5       +16 -1     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FilterParentPath.java
  
  Index: FilterParentPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FilterParentPath.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FilterParentPath.java	2001/07/30 13:35:40	1.4
  +++ FilterParentPath.java	2001/10/05 09:47:55	1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: FilterParentPath.java,v 1.4 2001/07/30 13:35:40 morten Exp $
  + * @(#)$Id: FilterParentPath.java,v 1.5 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -63,14 +63,17 @@
   
   package org.apache.xalan.xsltc.compiler;
   
  +import org.apache.xalan.xsltc.dom.Axis;
   import org.apache.xalan.xsltc.compiler.util.Type;
   import org.apache.xalan.xsltc.compiler.util.ReferenceType;
   import de.fub.bytecode.generic.*;
   import org.apache.xalan.xsltc.compiler.util.*;
   
   final class FilterParentPath extends Expression {
  +
       private Expression _filterExpr;
       private Expression _path;
  +    private boolean _hasDescendantAxis = false;
   
       public FilterParentPath(Expression filterExpr, Expression path) {
   	(_path = path).setParent(this);
  @@ -87,6 +90,10 @@
   	return "FilterParentPath(" + _filterExpr + ", " + _path + ')';
       }
   
  +    public void setDescendantAxis() {
  +	_hasDescendantAxis = true;
  +    }
  +
       /**
        * Type check a FilterParentPath. If the filter is not a node-set add a 
        * cast to node-set only if it is of reference type. This type coercion is
  @@ -139,5 +146,13 @@
   
   	// Initialize StepIterator with iterators from the stack
   	il.append(new INVOKESPECIAL(initSI));
  +
  +	// This is a special case for the //* path with or without predicates
  +        if (_hasDescendantAxis) {
  +	    final int incl = cpg.addMethodref(STEP_ITERATOR_CLASS,
  +					      "includeSelf",
  +					      "()"+NODE_ITERATOR_SIG);
  +	    il.append(new INVOKEVIRTUAL(incl));
  +	}
       }
   }
  
  
  
  1.8       +14 -1     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ParentLocationPath.java
  
  Index: ParentLocationPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ParentLocationPath.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParentLocationPath.java	2001/09/20 14:35:15	1.7
  +++ ParentLocationPath.java	2001/10/05 09:47:55	1.8
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ParentLocationPath.java,v 1.7 2001/09/20 14:35:15 morten Exp $
  + * @(#)$Id: ParentLocationPath.java,v 1.8 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -143,6 +143,19 @@
   
   	// Initialize StepIterator with iterators from the stack
   	il.append(new INVOKESPECIAL(initSI));
  +
  +	// This is a special case for the //* path with or without predicates
  +	if ((_path instanceof Step) && (_step instanceof Step)) {
  +	    final Step path = (Step)_path;
  +	    final Step step = (Step)_step;
  +	    if ((path.getAxis() == Axis.DESCENDANTORSELF) &&
  +		(step.getAxis() == Axis.CHILD)) {
  +		final int incl = cpg.addMethodref(STEP_ITERATOR_CLASS,
  +						  "includeSelf",
  +						  "()"+NODE_ITERATOR_SIG);
  +		il.append(new INVOKEVIRTUAL(incl));
  +	    }
  +	}
   
   	/*
   	 * If this pattern contains a sequence of descendant iterators we
  
  
  
  1.18      +11 -7     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java
  
  Index: Step.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Step.java	2001/10/04 12:11:57	1.17
  +++ Step.java	2001/10/05 09:47:55	1.18
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Step.java,v 1.17 2001/10/04 12:11:57 morten Exp $
  + * @(#)$Id: Step.java,v 1.18 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -405,13 +405,13 @@
   	    // Handle '//*[n]' expression
   	    else if (predicate.isNthDescendant()) {
   		il.append(methodGen.loadDOM());
  -		//il.append(methodGen.loadContextNode());
  -		il.append(new ICONST(-1));
  +		il.append(new ICONST(NodeTest.ELEMENT));
   		predicate.translate(classGen, methodGen);
  +		il.append(new ICONST(0));
   		idx = cpg.addInterfaceMethodref(DOM_INTF,
   						"getNthDescendant",
  -						"(II)"+NODE_ITERATOR_SIG);
  -		il.append(new INVOKEINTERFACE(idx, 3));
  +						"(IIZ)"+NODE_ITERATOR_SIG);
  +		il.append(new INVOKEINTERFACE(idx, 4));
   	    }
   	    // Handle 'elem[n]' expression
   	    else if (predicate.isNthPositionFilter()) {
  @@ -422,10 +422,14 @@
   		    il.append(methodGen.loadDOM());
   		    il.append(new PUSH(cpg, _nodeType));
   		    predicate.translate(classGen, methodGen);
  +		    if (_axis == Axis.DESCENDANT)
  +			il.append(new ICONST(0));
  +		    else
  +			il.append(new ICONST(1));
   		    idx = cpg.addInterfaceMethodref(DOM_INTF,
   						    "getNthDescendant",
  -						    "(II)"+NODE_ITERATOR_SIG);
  -		    il.append(new INVOKEINTERFACE(idx, 3));		    
  +						    "(IIZ)"+NODE_ITERATOR_SIG);
  +		    il.append(new INVOKEINTERFACE(idx, 4));
   		}
   		else {
   		    idx = cpg.addMethodref(NTH_ITERATOR_CLASS,
  
  
  
  1.17      +21 -28    xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup
  
  Index: xpath.cup
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- xpath.cup	2001/09/25 15:57:22	1.16
  +++ xpath.cup	2001/10/05 09:47:55	1.17
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: xpath.cup,v 1.16 2001/09/25 15:57:22 morten Exp $
  + * @(#)$Id: xpath.cup,v 1.17 2001/10/05 09:47:55 morten Exp $
    *
    * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
    * 
  @@ -407,10 +407,11 @@
           | FilterExpr:fexp DSLASH RelativeLocationPath:rlp
           {:
              // Expand '//' into '/descendant-or-self::node()/'
  -           Step nodeStep = new Step(Axis.DESCENDANTORSELF, 
  -	                            NodeTest.ANODE, null); 
  -           RESULT = new FilterParentPath(
  -	                new FilterParentPath(fexp, nodeStep), rlp);
  +           Step step = new Step(Axis.DESCENDANTORSELF, NodeTest.ANODE, null);
  +           FilterParentPath fpp = new FilterParentPath(fexp, step);
  +           fpp = new FilterParentPath(fpp, rlp);
  +           fpp.setDescendantAxis();
  +           RESULT = fpp;
           :};
   
   LocationPath ::= RelativeLocationPath:rlp
  @@ -481,33 +482,25 @@
   AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp
           {:
   
  -	// GTM bug fix 2553; 3360 (handles predicates in nodeStep2). 
  -	AbsoluteLocationPath absLocPath = null;
  +	AbsoluteLocationPath alp = null;
  +
  +        Step left = new Step(Axis.DESCENDANTORSELF, -1, null);
  +
   	if (rlp instanceof ParentLocationPath) {
  -	    // GTM, bug fix 3312  
  -            Step nodeStep1 = new Step(Axis.DESCENDANTORSELF, -1, null);
  -	    ParentLocationPath parLocPath = new ParentLocationPath(nodeStep1,
  -		rlp);
  -	    absLocPath = new AbsoluteLocationPath(parLocPath);
  +	    ParentLocationPath plp = new ParentLocationPath(left, rlp);
  +	    alp = new AbsoluteLocationPath(plp);
   	}
  -	else {
  -	    int nodeType = NodeTest.ELEMENT;
  -            int axis = Axis.CHILD;
  -            Vector predicates = null;
  -
  -	    if (rlp instanceof Step) {
  -                nodeType = ((Step)rlp).getNodeType();
  -                axis = ((Step)rlp).getAxis();
  -                predicates = ((Step)rlp).getPredicates();
  -	    }
  - 	    // create the new abs location path
  -            Step nodeStep1 = new Step(Axis.DESCENDANTORSELF, -1, null);
  -            Step nodeStep2 = new Step(axis, nodeType, predicates);
  -	    absLocPath = new AbsoluteLocationPath(
  -                   new ParentLocationPath(nodeStep1, nodeStep2));
  +	else if (rlp instanceof Step) {
  +            Step right = (Step)rlp;
  +            alp = new AbsoluteLocationPath(new ParentLocationPath(left, right));
   	}
  +	else {
  +            // Don't think we'll ever get here...
  +            Step right = new Step(Axis.CHILD, NodeTest.ELEMENT, null);
  +	    alp = new AbsoluteLocationPath(new ParentLocationPath(left, right));
  +        }
   
  -	RESULT = new FilteredAbsoluteLocationPath(absLocPath);	
  +	RESULT = new FilteredAbsoluteLocationPath(alp);
   	:};
   
   
  
  
  
  1.8       +3 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMAdapter.java	2001/10/02 11:17:32	1.7
  +++ DOMAdapter.java	2001/10/05 09:47:55	1.8
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOMAdapter.java,v 1.7 2001/10/02 11:17:32 morten Exp $
  + * @(#)$Id: DOMAdapter.java,v 1.8 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -148,8 +148,8 @@
   	return(iterator);
       }
   
  -    public NodeIterator getNthDescendant(int type, int n) {
  -	return _domImpl.getNthDescendant(_reverse[type], n);
  +    public NodeIterator getNthDescendant(int type, int n, boolean includeself) {
  +	return _domImpl.getNthDescendant(_reverse[type], n, includeself);
       }
   
       public NodeIterator getNodeValueIterator(NodeIterator iterator, int type,
  
  
  
  1.37      +108 -62   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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DOMImpl.java	2001/10/04 12:19:33	1.36
  +++ DOMImpl.java	2001/10/05 09:47:55	1.37
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOMImpl.java,v 1.36 2001/10/04 12:19:33 morten Exp $
  + * @(#)$Id: DOMImpl.java,v 1.37 2001/10/05 09:47:55 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -108,6 +108,7 @@
   	    public NodeIterator cloneIterator() { return this; }
   	    public boolean isReverse() { return false; }
   	    public NodeIterator resetOnce() { return this; }
  +	    public NodeIterator includeSelf() { return this; }
   	};
   
       // Contains the number of nodes and attribute nodes in the tree
  @@ -594,17 +595,39 @@
   	private int _last = -1;
   
   	public NodeIterator setStartNode(final int node) {
  -	    _last = -1;
  +	    if (node != _startNode) _last = -1;
  +
   	    if (_isRestartable) {
  -		_currentChild = hasChildren(node)
  -		    ? _offsetOrChild[_startNode = node] : END;
  +		_startNode = node;
  +		if (_includeSelf) {
  +		    _currentChild = -1;
  +		}
  +		else {
  +		    if (hasChildren(node))
  +			_currentChild = _offsetOrChild[node];
  +		    else
  +			_currentChild = END;
  +		}
   		return resetPosition();
   	    }
   	    return this;
   	}
   
   	public int next() {
  -	    final int node = _currentChild;
  +	    int node = _currentChild;
  +	    if (_includeSelf) {
  +		if (node == -1) {
  +		    node = _startNode;
  +		    if (hasChildren(node))
  +			_currentChild = _offsetOrChild[node];
  +		    else
  +			_currentChild = END;
  +		    // IMPORTANT: The start node (parent of all children) is
  +		    // returned, but the node position counter (_position)
  +		    // should not be increased, so returnNode() is not called
  +		    return node;
  +		}
  +	    }
   	    _currentChild = _nextSibling[node];
   	    return returnNode(node);
   	}
  @@ -1317,8 +1340,7 @@
   
   	public int next() {
   	    while (++_node < _limit) {
  -		if (_type[_node] > TEXT)
  -		    return(returnNode(_node));
  +		if (_type[_node] > TEXT) return(returnNode(_node));
   	    } 
   	    return(NULL);
   	}
  @@ -1984,18 +2006,26 @@
        * Dump the whole tree to a file (serialized)
        */
       public void writeExternal(ObjectOutput out) throws IOException {
  -	out.writeInt(_treeNodeLimit);
  -	out.writeObject(_type);
  -	out.writeObject(_namespace);
  -	out.writeObject(_parent);
  -	out.writeObject(_nextSibling);
  -	out.writeObject(_offsetOrChild);
  -	out.writeObject(_lengthOrAttr);
  -	out.writeObject(_text);
  -	out.writeObject(_namesArray);
  -	out.writeObject(_uriArray);
  +	out.writeInt(_treeNodeLimit);      // number of nodes in DOM
  +	out.writeInt(_firstAttributeNode); // index of first attribute node
  +	out.writeObject(_documentURI);     // URI of original document
  +
  +	out.writeObject(_type);            // type of every node in DOM
  +	out.writeObject(_namespace);       // namespace URI of each type
  +	out.writeObject(_prefix);          // prefix type of every node in DOM
  +
  +	out.writeObject(_parent);          // parent of every node in DOM
  +	out.writeObject(_nextSibling);     // next sibling of every node in DOM
  +	out.writeObject(_offsetOrChild);   // first child of every node in DOM
  +	out.writeObject(_lengthOrAttr);    // first attr of every node in DOM
  +
  +	out.writeObject(_text);            // all text in DOM (text, PIs, etc)
  +	out.writeObject(_namesArray);      // names of all element/attr types
  +	out.writeObject(_uriArray);        // name of all URIs
  +	out.writeObject(_prefixArray);     // name of all prefixes
  +
   	out.writeObject(_whitespace);
  -	out.writeObject(_prefix);
  +
   	out.flush();
       }
   
  @@ -2005,17 +2035,25 @@
       public void readExternal(ObjectInput in)
   	throws IOException, ClassNotFoundException {
   	_treeNodeLimit = in.readInt();
  +	_firstAttributeNode = in.readInt();
  +	_documentURI = (String)in.readObject();
  +
   	_type          = (short[])in.readObject();
   	_namespace     = (short[])in.readObject();
  +	_prefix        = (short[])in.readObject();
  +
   	_parent        = (int[])in.readObject();
   	_nextSibling   = (int[])in.readObject();
   	_offsetOrChild = (int[])in.readObject();
   	_lengthOrAttr  = (int[])in.readObject();
  +
   	_text          = (char[])in.readObject();
   	_namesArray    = (String[])in.readObject();
   	_uriArray      = (String[])in.readObject();
  +	_prefixArray   = (String[])in.readObject();
  +
   	_whitespace    = (BitArray)in.readObject();
  -	_prefix        = (short[])in.readObject();
  +
   	_types         = setupMapping(_namesArray);
       }
   
  @@ -2023,7 +2061,8 @@
        * Constructor - defaults to 32K nodes
        */
       public DOMImpl() {
  -	this(32*1024);
  +	//this(32*1024);
  +	this(8*1024);
       }
            
       /**
  @@ -2038,7 +2077,7 @@
   	_text          = new char[size * 10];
   	_whitespace    = new BitArray(size);
   	_prefix        = new short[size];
  -	// _namesArray[] and _uriArray are allocated in endDocument
  +	// _namesArray[] and _uriArray[] are allocated in endDocument
       }
   
       /**
  @@ -2346,20 +2385,26 @@
        * a given type.
        */
       public NodeIterator getTypedDescendantIterator(int type) {
  -	NodeIterator iterator = new TypedDescendantIterator(type);
  -	iterator.setStartNode(1);
  +	NodeIterator iterator;
  +	if (type == ELEMENT)
  +	    iterator = new FilterIterator(new DescendantIterator(),
  +					  getElementFilter());
  +	else
  +	    iterator = new TypedDescendantIterator(type);
   	return(iterator);
       }
   
       /**
  -     * Returns the nth descendant of a node (1 = parent, 2 = gramps)
  +     * Returns the nth descendant of a node
        */
  -    public NodeIterator getNthDescendant(int type, int n) {
  +    public NodeIterator getNthDescendant(int type, int n, boolean includeself) {
   	NodeIterator source;
  -	if (type == -1)
  -	    source = new DescendantIterator();
  +	if (type == ELEMENT)
  +	    source = new FilterIterator(new DescendantIterator(),
  +					getElementFilter());
   	else
   	    source = new TypedDescendantIterator(type);
  +	if (includeself) ((NodeIteratorBase)source).includeSelf();
   	return(new NthDescendantIterator(source, n, type));
       }
   
  @@ -3203,41 +3248,42 @@
   	    _currentOffset += length;
   	}
   
  -	private void resizeArrays(final int newSize, final int length) {
  -	    if (newSize > length) {
  -		// Resize the '_type' array
  -		final short[] newType = new short[newSize];
  -		System.arraycopy(_type, 0, newType, 0, length);
  -		_type = newType;
  -
  -		// Resize the '_parent' array
  -		final int[] newParent = new int[newSize];
  -		System.arraycopy(_parent, 0, newParent, 0, length);
  -		_parent = newParent;
  -
  -		// Resize the '_nextSibling' array
  -		final int[] newNextSibling = new int[newSize];
  -		System.arraycopy(_nextSibling, 0, newNextSibling, 0, length);
  -		_nextSibling = newNextSibling;
  -
  -		// Resize the '_offsetOrChild' array
  -		final int[] newOffsetOrChild = new int[newSize];
  -		System.arraycopy(_offsetOrChild, 0, newOffsetOrChild, 0,length);
  -		_offsetOrChild = newOffsetOrChild;
  -
  -		// Resize the '_lengthOrAttr' array
  -		final int[] newLengthOrAttr = new int[newSize];
  -		System.arraycopy(_lengthOrAttr, 0, newLengthOrAttr, 0, length);
  -		_lengthOrAttr = newLengthOrAttr;
  -
  -		// Resize the '_whitespace' array (a BitArray instance)
  -		_whitespace.resize(newSize);
  -
  -		// Resize the '_prefix' array
  -		final short[] newPrefix = new short[newSize];
  -		System.arraycopy(_prefix, 0, newPrefix, 0, length);
  -		_prefix = newPrefix;
  -	    }
  +	private void resizeArrays(final int newSize, int length) {
  +	    if ((length < newSize) && (newSize == _currentNode))
  +		length = _currentNode;
  +
  +	    // Resize the '_type' array
  +	    final short[] newType = new short[newSize];
  +	    System.arraycopy(_type, 0, newType, 0, length);
  +	    _type = newType;
  +
  +	    // Resize the '_parent' array
  +	    final int[] newParent = new int[newSize];
  +	    System.arraycopy(_parent, 0, newParent, 0, length);
  +	    _parent = newParent;
  +
  +	    // Resize the '_nextSibling' array
  +	    final int[] newNextSibling = new int[newSize];
  +	    System.arraycopy(_nextSibling, 0, newNextSibling, 0, length);
  +	    _nextSibling = newNextSibling;
  +
  +	    // Resize the '_offsetOrChild' array
  +	    final int[] newOffsetOrChild = new int[newSize];
  +	    System.arraycopy(_offsetOrChild, 0, newOffsetOrChild, 0,length);
  +	    _offsetOrChild = newOffsetOrChild;
  +
  +	    // Resize the '_lengthOrAttr' array
  +	    final int[] newLengthOrAttr = new int[newSize];
  +	    System.arraycopy(_lengthOrAttr, 0, newLengthOrAttr, 0, length);
  +	    _lengthOrAttr = newLengthOrAttr;
  +
  +	    // Resize the '_whitespace' array (a BitArray instance)
  +	    _whitespace.resize(newSize);
  +
  +	    // Resize the '_prefix' array
  +	    final short[] newPrefix = new short[newSize];
  +	    System.arraycopy(_prefix, 0, newPrefix, 0, length);
  +	    _prefix = newPrefix;
   	}
   	
   	private void resizeArrays2(final int newSize, final int length) {
  
  
  
  1.2       +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/dom/FilterIterator.java
  
  Index: FilterIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/FilterIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FilterIterator.java	2001/04/17 18:52:31	1.1
  +++ FilterIterator.java	2001/10/05 09:47:56	1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: FilterIterator.java,v 1.1 2001/04/17 18:52:31 sboag Exp $
  + * @(#)$Id: FilterIterator.java,v 1.2 2001/10/05 09:47:56 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -111,7 +111,6 @@
   
       public NodeIterator setStartNode(int node) {
   	if (_isRestartable) {
  -	    // iterator is not a clone
   	    _source.setStartNode(_startNode = node); 
   	    return resetPosition();
   	}
  @@ -125,4 +124,5 @@
       public void gotoMark() {
   	_source.gotoMark();
       }
  +
   }
  
  
  
  1.8       +3 -3      xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java
  
  Index: MultiDOM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MultiDOM.java	2001/09/21 11:55:55	1.7
  +++ MultiDOM.java	2001/10/05 09:47:56	1.8
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: MultiDOM.java,v 1.7 2001/09/21 11:55:55 morten Exp $
  + * @(#)$Id: MultiDOM.java,v 1.8 2001/10/05 09:47:56 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -230,8 +230,8 @@
   	return new AxisIterator(axis, type);
       }
   
  -    public NodeIterator getNthDescendant(int node, int n) {
  -	return _adapters[node>>>24].getNthDescendant(node & CLR, n);
  +    public NodeIterator getNthDescendant(int node, int n, boolean includeself) {
  +	return _adapters[node>>>24].getNthDescendant(node & CLR,n,includeself);
       }
   
       public NodeIterator getNodeValueIterator(NodeIterator iterator, int type,
  
  
  
  1.7       +3 -2      xml-xalan/java/src/org/apache/xalan/xsltc/dom/NthIterator.java
  
  Index: NthIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/NthIterator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NthIterator.java	2001/09/26 12:19:43	1.6
  +++ NthIterator.java	2001/10/05 09:47:56	1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: NthIterator.java,v 1.6 2001/09/26 12:19:43 morten Exp $
  + * @(#)$Id: NthIterator.java,v 1.7 2001/10/05 09:47:56 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -81,7 +81,8 @@
   	if (_ready && _position > 0) {
   	    _ready = false;
   	    // skip N-1 nodes
  -	    for (int n = _position - 1; n-- > 0;) {
  +	    final int pos = _position;
  +	    for (int n = pos - 1; n-- > 0;) {
   		if (_source.next() == NodeIterator.END) {
   		    return NodeIterator.END;
   		}
  
  
  
  1.6       +12 -4     xml-xalan/java/src/org/apache/xalan/xsltc/dom/StepIterator.java
  
  Index: StepIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/StepIterator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StepIterator.java	2001/09/19 13:22:51	1.5
  +++ StepIterator.java	2001/10/05 09:47:56	1.6
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: StepIterator.java,v 1.5 2001/09/19 13:22:51 morten Exp $
  + * @(#)$Id: StepIterator.java,v 1.6 2001/10/05 09:47:56 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -98,8 +98,12 @@
   	if (_isRestartable) {
   	    // Set start node for left-hand iterator...
   	    _source.setStartNode(_startNode = node);
  -	    // ... and get start node for right-hand iterator from left-hand.
  -	    _iterator.setStartNode(_source.next());
  +	    // ... and get start node for right-hand iterator from left-hand,
  +	    // with special case for //* path - see ParentLocationPath
  +	    if (_includeSelf)
  +		_iterator.setStartNode(_startNode);
  +	    else
  +		_iterator.setStartNode(_source.next());
   	    return resetPosition();
   	}
   	return this;
  @@ -107,7 +111,11 @@
   
       public NodeIterator reset() {
   	_source.reset();
  -	_iterator.setStartNode(_source.next());
  +	// Special case for //* path - see ParentLocationPath
  +	if (_includeSelf)
  +	    _iterator.setStartNode(_startNode);
  +	else
  +	    _iterator.setStartNode(_source.next());
   	return resetPosition();
       }
       
  
  
  

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