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/09/17 23:09:00 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom MultiDOM.java

zongaro     2002/09/17 14:09:00

  Modified:    java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        MultiDOM.java
  Log:
  Work around problem with document('') function when transformation happens
  through a TransformerHandler.  (See constructor for more details.)  Also, fixed
  some spacing problems.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.16.10.4 +349 -294  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.16.10.3
  retrieving revision 1.16.10.4
  diff -u -r1.16.10.3 -r1.16.10.4
  --- MultiDOM.java	24 Aug 2002 11:33:23 -0000	1.16.10.3
  +++ MultiDOM.java	17 Sep 2002 21:09:00 -0000	1.16.10.4
  @@ -96,84 +96,88 @@
       private Hashtable _documents = new Hashtable();
   
       private final class AxisIterator extends DTMAxisIteratorBase {
  -	// constitutive data
  -	private final int _axis;
  -	private final int _type;
  -	// implementation mechanism
  -	private DTMAxisIterator _source;
  -	private int _mask;
  -	
  -	public AxisIterator(final int axis, final int type) {
  -	    _axis = axis;
  -	    _type = type;
  -	}
  -	
  -	public int next() {
  -	    if (_source == null) return(END);
  -	    return _source.next();
  -	}
  -	
  -
  -	public void setRestartable(boolean flag) {
  -	    _source.setRestartable(flag);
  -	}
  -
  -	public DTMAxisIterator setStartNode(final int node) {
  -	    if (node == DTM.NULL) return this;
  -		
  -	    int nodeid = getNodeIdent(node); 
  -	    final int mask = nodeid & SET;
  -	    int dom = getDTMId(node);
  +        // constitutive data
  +        private final int _axis;
  +        private final int _type;
  +        // implementation mechanism
  +        private DTMAxisIterator _source;
  +        private int _mask;
  +
  +        public AxisIterator(final int axis, final int type) {
  +            _axis = axis;
  +            _type = type;
  +        }
  +
  +        public int next() {
  +            if (_source == null) {
  +                return(END);
  +            }
  +            return _source.next();
  +        }
  +
  +
  +        public void setRestartable(boolean flag) {
  +            _source.setRestartable(flag);
  +        }
  +
  +        public DTMAxisIterator setStartNode(final int node) {
  +            if (node == DTM.NULL) {
  +                return this;
  +            }
  +
  +            int nodeid = getNodeIdent(node); 
  +            final int mask = nodeid & SET;
  +            int dom = getDTMId(node);
   
               // Get a new source first time and when mask changes
  -	    if (_source == null || _mask != mask) {
  -	        if (_type == NO_TYPE) {
  -		    _source = _adapters[dom].getAxisIterator(_axis);
  -	        }
  -	        else if (_axis == Axis.CHILD && _type != DTM.ELEMENT_NODE) {
  -		    _source = _adapters[dom].getTypedChildren(_type);
  -	        }
  -	        else {
  -		    _source = _adapters[dom].getTypedAxisIterator(_axis, _type);
  -		}
  -	    }
  -
  -	    _mask = mask;
  -	    _source.setStartNode(node & CLR);
  -	    return this;
  -	}
  -
  -	public DTMAxisIterator reset() {
  -	    if (_source != null) _source.reset();
  -	    return this;
  -	}
  -    
  -	public int getLast() {
  -	    return _source.getLast();
  -	}
  -    
  -	public int getPosition() {
  -	    return _source.getPosition();
  -	}
  -    
  -	public boolean isReverse() {
  -	    return (_source == null) ? false : _source.isReverse();
  -	}
  -    
  -	public void setMark() {
  -	    _source.setMark();
  -	}
  -    
  -	public void gotoMark() {
  -	    _source.gotoMark();
  -	}
  -    
  -	public DTMAxisIterator cloneIterator() {
  -	    final AxisIterator clone = new AxisIterator(_axis, _type);
  -	    clone._source = _source.cloneIterator();
  -	    clone._mask = _mask;
  -	    return clone;
  -	}
  +            if (_source == null || _mask != mask) {
  +                if (_type == NO_TYPE) {
  +                    _source = _adapters[dom].getAxisIterator(_axis);
  +                } else if (_axis == Axis.CHILD && _type != DTM.ELEMENT_NODE) {
  +                    _source = _adapters[dom].getTypedChildren(_type);
  +                } else {
  +                    _source = _adapters[dom].getTypedAxisIterator(_axis, _type);
  +                }
  +            }
  +
  +            _mask = mask;
  +            _source.setStartNode(node & CLR);
  +            return this;
  +        }
  +
  +        public DTMAxisIterator reset() {
  +            if (_source != null) {
  +                _source.reset();
  +            }
  +            return this;
  +        }
  +    
  +        public int getLast() {
  +            return _source.getLast();
  +        }
  +
  +        public int getPosition() {
  +            return _source.getPosition();
  +        }
  +    
  +        public boolean isReverse() {
  +            return (_source == null) ? false : _source.isReverse();
  +        }
  +    
  +        public void setMark() {
  +            _source.setMark();
  +        }
  +    
  +        public void gotoMark() {
  +            _source.gotoMark();
  +        }
  +    
  +        public DTMAxisIterator cloneIterator() {
  +            final AxisIterator clone = new AxisIterator(_axis, _type);
  +            clone._source = _source.cloneIterator();
  +            clone._mask = _mask;
  +            return clone;
  +        }
   
       } // end of AxisIterator
   
  @@ -184,374 +188,425 @@
        */
       private final class NodeValueIterator extends DTMAxisIteratorBase {
   
  -	private DTMAxisIterator _source;
  -	private String _value;
  -	private boolean _op;
  -	private final boolean _isReverse;
  -	private int _returnType = RETURN_PARENT;
  -
  -	public NodeValueIterator(DTMAxisIterator source, int returnType,
  -				 String value, boolean op) {
  -	    _source = source;
  -	    _returnType = returnType;
  -	    _value = value;
  -	    _op = op;
  -	    _isReverse = source.isReverse();
  -	}
  -
  -	public boolean isReverse() {
  -	    return _isReverse;
  -	}
  -    
  -	public DTMAxisIterator cloneIterator() {
  -	    try {
  -		NodeValueIterator clone = (NodeValueIterator)super.clone();
  -		clone._source = _source.cloneIterator();
  -		clone.setRestartable(false);
  -		return clone.reset();
  -	    }
  -	    catch (CloneNotSupportedException e) {
  -		BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
  -					  e.toString());
  -		return null;
  -	    }
  -	}
  -
  -
  -	public void setRestartable(boolean isRestartable) {
  -	    _isRestartable = isRestartable;
  -	    _source.setRestartable(isRestartable);
  -	}
  -
  -	public DTMAxisIterator reset() {
  -	    _source.reset();
  -	    return resetPosition();
  -	}
  -
  -	public int next() {
  -
  -	    int node;
  -	    while ((node = _source.next()) != END) {
  -		String val = getNodeValue(node);
  -		if (_value.equals(val) == _op) {
  -		    if (_returnType == RETURN_CURRENT)
  -			return returnNode(node);
  -		    else
  -			return returnNode(getParent(node));
  -		}
  -	    }
  -	    return END;
  -	}
  -
  -	public DTMAxisIterator setStartNode(int node) {
  -	    if (_isRestartable) {
  -		_source.setStartNode(_startNode = node); 
  -		return resetPosition();
  -	    }
  -	    return this;
  -	}
  -
  -	public void setMark() {
  -	    _source.setMark();
  -	}
  -
  -	public void gotoMark() {
  -	    _source.gotoMark();
  -	}
  +        private DTMAxisIterator _source;
  +        private String _value;
  +        private boolean _op;
  +        private final boolean _isReverse;
  +        private int _returnType = RETURN_PARENT;
  +
  +        public NodeValueIterator(DTMAxisIterator source, int returnType,
  +                                 String value, boolean op) {
  +            _source = source;
  +            _returnType = returnType;
  +            _value = value;
  +            _op = op;
  +            _isReverse = source.isReverse();
  +        }
  +
  +        public boolean isReverse() {
  +            return _isReverse;
  +        }
  +    
  +        public DTMAxisIterator cloneIterator() {
  +            try {
  +                NodeValueIterator clone = (NodeValueIterator)super.clone();
  +                clone._source = _source.cloneIterator();
  +                clone.setRestartable(false);
  +                return clone.reset();
  +            }
  +            catch (CloneNotSupportedException e) {
  +                BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR,
  +                                          e.toString());
  +                return null;
  +            }
  +        }
  +
  +
  +        public void setRestartable(boolean isRestartable) {
  +            _isRestartable = isRestartable;
  +            _source.setRestartable(isRestartable);
  +        }
  +
  +        public DTMAxisIterator reset() {
  +            _source.reset();
  +            return resetPosition();
  +        }
  +
  +        public int next() {
  +
  +            int node;
  +            while ((node = _source.next()) != END) {
  +                String val = getNodeValue(node);
  +                if (_value.equals(val) == _op) {
  +                    if (_returnType == RETURN_CURRENT)
  +                        return returnNode(node);
  +                    else
  +                        return returnNode(getParent(node));
  +                }
  +            }
  +            return END;
  +        }
  +
  +        public DTMAxisIterator setStartNode(int node) {
  +            if (_isRestartable) {
  +                _source.setStartNode(_startNode = node); 
  +                return resetPosition();
  +            }
  +            return this;
  +        }
  +
  +        public void setMark() {
  +            _source.setMark();
  +        }
  +
  +        public void gotoMark() {
  +            _source.gotoMark();
  +        }
       }                       
   
       public MultiDOM(DOM main) {
  -	_size = INITIAL_SIZE;
  -	_free = 1;
  -	_adapters = new DOM[INITIAL_SIZE];
  -	_adapters[0] = main;
  -	addDOMAdapter((DOMAdapter) main);
  +        _size = INITIAL_SIZE;
  +        _free = 1;
  +        _adapters = new DOM[INITIAL_SIZE];
  +        _adapters[0] = main;
  +
  +        // %HZ% %REVISIT% Is this the right thing to do here?  In the old
  +        // %HZ% %REVISIT% version, the main document did not get added through
  +        // %HZ% %REVISIT% a call to addDOMAdapter, which meant it couldn't be
  +        // %HZ% %REVISIT% found by a call to getDocumentMask.  The problem is
  +        // %HZ% %REVISIT% TransformerHandler is typically constructed with a
  +        // %HZ% %REVISIT% system ID equal to the stylesheet's URI; with SAX
  +        // %HZ% %REVISIT% input, it ends up giving that URI to the document.
  +        // %HZ% %REVISIT% Then, any references to document('') are resolved
  +        // %HZ% %REVISIT% using the stylesheet's URI.
  +        // %HZ% %REVISIT% MultiDOM.getDocumentMask is called to verify that
  +        // %HZ% %REVISIT% a document associated with that URI has not been
  +        // %HZ% %REVISIT% encountered, and that method ends up returning the
  +        // %HZ% %REVISIT% mask of the main document, when what we really what
  +        // %HZ% %REVISIT% is to read the stylesheet itself!
  +        addDOMAdapter((DOMAdapter) main, false);
       }
   
       public int nextMask() {
  -	return(_free << 24);
  +        return(_free << 24);
       }
   
       public void setupMapping(String[] names, String[] namespaces) {
  -	// This method only has a function in DOM adapters
  +        // This method only has a function in DOM adapters
       }
   
       public int addDOMAdapter(DOMAdapter dom) {
  -	// Add the DOM adapter to the array of DOMs
  -	DTMManager dtmManager = ((DTMDefaultBase)((DOMAdapter)dom).getDOMImpl()).m_mgr;
  -    final int domNo = dtmManager.getDTMIdentity((DTM)((DOMAdapter)dom).getDOMImpl()) >>> DTMManager.IDENT_DTM_NODE_BITS;
  +        return addDOMAdapter(dom, true);
  +    }
  +
  +    private int addDOMAdapter(DOMAdapter dom, boolean indexByURI) {
  +        // Add the DOM adapter to the array of DOMs
  +        DTMManager dtmManager =
  +                      ((DTMDefaultBase)((DOMAdapter)dom).getDOMImpl()).m_mgr;
  +        final int domNo =
  +             dtmManager.getDTMIdentity((DTM)((DOMAdapter)dom).getDOMImpl())
  +                   >>> DTMManager.IDENT_DTM_NODE_BITS;
     
  -	//final int domNo = _free++;
  -	if (domNo == _size) {
  -	    final DOMAdapter[] newArray = new DOMAdapter[_size *= 2];
  -	    System.arraycopy(_adapters, 0, newArray, 0, domNo);
  -	    _adapters = newArray;
  -	}
  -	_adapters[domNo] = dom;
  -
  -	// Store reference to document (URI) in hashtable
  -	String uri = dom.getDocumentURI(0);
  -	_documents.put(uri, new Integer(domNo));
  -	
  -	// Store mask in DOMAdapter
  -	dom.setMultiDOMMask(domNo << 24);
  -	return (domNo << 24);
  +        if (domNo == _size) {
  +            final DOMAdapter[] newArray = new DOMAdapter[_size *= 2];
  +            System.arraycopy(_adapters, 0, newArray, 0, domNo);
  +            _adapters = newArray;
  +        }
  +        _adapters[domNo] = dom;
  +
  +        // Store reference to document (URI) in hashtable
  +        if (indexByURI) {
  +            String uri = dom.getDocumentURI(0);
  +            _documents.put(uri, new Integer(domNo));
  +        }
  +        
  +        // Store mask in DOMAdapter
  +        dom.setMultiDOMMask(domNo << 24);
  +        return (domNo << 24);
       }
  -    
  +        
       public int getDocumentMask(String uri) {
  -	Integer domIdx = (Integer)_documents.get(uri);
  -	if (domIdx == null)
  -	    return(-1);
  -	else
  -	    return((domIdx.intValue() << 24));
  +        Integer domIdx = (Integer)_documents.get(uri);
  +        if (domIdx == null) {
  +            return(-1);
  +        } else {
  +            return((domIdx.intValue() << 24));
  +        }
       }
       
       public DOM getDOMAdapter(String uri) {
  -	Integer domIdx = (Integer)_documents.get(uri);
  -	if (domIdx == null)
  -	    return(null);
  -	else
  -	    return(_adapters[domIdx.intValue()]);
  +        Integer domIdx = (Integer)_documents.get(uri);
  +        if (domIdx == null) {
  +            return(null);
  +        } else {
  +            return(_adapters[domIdx.intValue()]);
  +        }
       }
       
       public int getDocument() 
       {
  -      return _adapters[0].getDocument();
  +        return _adapters[0].getDocument();
       }
   
       /** 
         * Returns singleton iterator containing the document root 
         */
       public DTMAxisIterator getIterator() {
  -	// main source document @ 0
  -	return _adapters[0].getIterator();
  +        // main source document @ 0
  +        return _adapters[0].getIterator();
       }
       
       public String getStringValue() {
  -	return _adapters[0].getStringValue();
  +        return _adapters[0].getStringValue();
       }
   
       public String getTreeString() {
  -	return _adapters[0].getTreeString();
  +        return _adapters[0].getTreeString();
       }
       
       public DTMAxisIterator getChildren(final int node) {
  -	return _adapters[getDTMId(node)].getChildren(node);
  -	/*(node & SET) == 0
  -	    ? _adapters[0].getChildren(node)
  -	    : getAxisIterator(Axis.CHILD).setStartNode(node);*/
  +        return _adapters[getDTMId(node)].getChildren(node);
       }
       
       public DTMAxisIterator getTypedChildren(final int type) {
  -	return new AxisIterator(Axis.CHILD, type);
  +        return new AxisIterator(Axis.CHILD, type);
       }
       
       public DTMAxisIterator getAxisIterator(final int axis) {
  -	return new AxisIterator(axis, NO_TYPE);
  +        return new AxisIterator(axis, NO_TYPE);
       }
       
  -    public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) {
  -	return new AxisIterator(axis, type);
  +    public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
  +    {
  +        return new AxisIterator(axis, type);
       }
   
  -    public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself) {
  -	return _adapters[getDTMId(node)].getNthDescendant(node & CLR,n,includeself);
  +    public DTMAxisIterator getNthDescendant(int node, int n,
  +                                            boolean includeself)
  +    {
  +        return _adapters[getDTMId(node)].getNthDescendant(node & CLR,n,
  +                                                          includeself);
       }
   
  -    public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator, int type,
  -					     String value, boolean op) {
  -	return(new NodeValueIterator(iterator, type, value, op));
  +    public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iterator,
  +                                                int type, String value,
  +                                                boolean op)
  +    {
  +        return(new NodeValueIterator(iterator, type, value, op));
       }
   
  -    public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns) {
  -	DTMAxisIterator iterator = _adapters[0].getNamespaceAxisIterator(axis,ns);
  -	return(iterator);	
  +    public DTMAxisIterator getNamespaceAxisIterator(final int axis,
  +                                                    final int ns)
  +    {
  +        DTMAxisIterator iterator = _adapters[0].getNamespaceAxisIterator(axis,
  +                                                                         ns);
  +        return(iterator);        
       }
   
       public DTMAxisIterator orderNodes(DTMAxisIterator source, int node) {
  -	return _adapters[getDTMId(node)].orderNodes(source, node & CLR);
  +        return _adapters[getDTMId(node)].orderNodes(source, node & CLR);
       }
   
       public int getType(final int node) {
  -	return _adapters[getDTMId(node)].getType(node & CLR);
  +        return _adapters[getDTMId(node)].getType(node & CLR);
       }
   
       public int getNamespaceType(final int node) {
  -	return _adapters[getDTMId(node)].getNamespaceType(node & CLR);
  +        return _adapters[getDTMId(node)].getNamespaceType(node & CLR);
       }
       
       public int getNSType(int node)
      {
  -	return _adapters[getDTMId(node)].getNSType(node & CLR);
  +        return _adapters[getDTMId(node)].getNSType(node & CLR);
      }
       
       public int getParent(final int node) {
  -    	if (node == DTM.NULL)
  -    	return DTM.NULL;
  -	return _adapters[getDTMId(node)].getParent(node & CLR) | node&SET;
  +        if (node == DTM.NULL) {
  +            return DTM.NULL;
  +        }
  +        return _adapters[getDTMId(node)].getParent(node & CLR) | node&SET;
       }
       
       public int getTypedPosition(int type, int node) {
  -	return _adapters[getDTMId(node)].getTypedPosition(type, node&CLR);
  +        return _adapters[getDTMId(node)].getTypedPosition(type, node&CLR);
       }
   
       public int getTypedLast(int type, int node) {
  -	return _adapters[getDTMId(node)].getTypedLast(type, node&CLR);
  +        return _adapters[getDTMId(node)].getTypedLast(type, node&CLR);
       }
   
       public int getAttributeNode(final int type, final int el) {
  -    	if (el == DTM.NULL)
  -    	return DTM.NULL;
  -	return _adapters[getDTMId(el)].getAttributeNode(type, el&CLR) | el&SET;
  +        if (el == DTM.NULL) {
  +            return DTM.NULL;
  +        }
  +        return _adapters[getDTMId(el)].getAttributeNode(type, el&CLR) | el&SET;
       }
       
       public String getNodeName(final int node) {
  -    	if (node == DTM.NULL)
  -    	return "";
  -	return _adapters[getDTMId(node)].getNodeName(node & CLR);
  +        if (node == DTM.NULL) {
  +            return "";
  +        }
  +        return _adapters[getDTMId(node)].getNodeName(node & CLR);
       }
       
       public String getNodeNameX(final int node) {
  -    	if (node == DTM.NULL)
  -    	return "";
  -	return _adapters[getDTMId(node)].getNodeNameX(node & CLR);
  +        if (node == DTM.NULL) {
  +            return "";
  +        }
  +        return _adapters[getDTMId(node)].getNodeNameX(node & CLR);
       }
   
       public String getNamespaceName(final int node) {
  -    	if (node == DTM.NULL)
  -    	return "";
  -	return _adapters[getDTMId(node)].getNamespaceName(node & CLR);
  +        if (node == DTM.NULL) {
  +            return "";
  +        }
  +        return _adapters[getDTMId(node)].getNamespaceName(node & CLR);
       }
       
       public String getNodeValue(final int node) {
  -    	if (node == DTM.NULL)
  -    	return "";
  -	return _adapters[getDTMId(node)].getNodeValue(node & CLR);
  +        if (node == DTM.NULL) {
  +            return "";
  +        }
  +        return _adapters[getDTMId(node)].getNodeValue(node & CLR);
       }
       
       public void copy(final int node, TransletOutputHandler handler)
  -	throws TransletException {
  -		if (node != DTM.NULL)
  -	_adapters[getDTMId(node)].copy(node & CLR, handler);
  +        throws TransletException
  +    {
  +        if (node != DTM.NULL) {
  +            _adapters[getDTMId(node)].copy(node & CLR, handler);
  +        }
       }
       
       public void copy(DTMAxisIterator nodes, TransletOutputHandler handler)
  -	throws TransletException {
  -	int node;
  -	while ((node = nodes.next()) != DTM.NULL) {
  -	    _adapters[getDTMId(node)].copy(node & CLR, handler);
  -	}
  +            throws TransletException
  +    {
  +        int node;
  +        while ((node = nodes.next()) != DTM.NULL) {
  +            _adapters[getDTMId(node)].copy(node & CLR, handler);
  +        }
       }
   
   
       public String shallowCopy(final int node, TransletOutputHandler handler)
  -	throws TransletException {
  -		if (node == DTM.NULL)
  -    	return "";
  -	return _adapters[getDTMId(node)].shallowCopy(node & CLR, handler);
  +            throws TransletException
  +    {
  +        if (node == DTM.NULL) {
  +            return "";
  +        }
  +        return _adapters[getDTMId(node)].shallowCopy(node & CLR, handler);
       }
       
       public boolean lessThan(final int node1, final int node2) {
  -    	if (node1 == DTM.NULL) return true;
  -    	if (node2 == DTM.NULL) return false;
  -   // int nodeid1 = getNodeIdent(node1);
  -    //int nodeid2 = getNodeIdent(node2); 
  -	final int dom1 = getDTMId(node1);
  -	final int dom2 = getDTMId(node2);
  -	return dom1 == dom2
  -	    ? _adapters[dom1].lessThan(node1 & CLR, node2 & CLR)
  -	    : dom1 < dom2;
  +        if (node1 == DTM.NULL) {
  +            return true;
  +        }
  +        if (node2 == DTM.NULL) {
  +            return false;
  +        }
  +        final int dom1 = getDTMId(node1);
  +        final int dom2 = getDTMId(node2);
  +        return dom1 == dom2 ? _adapters[dom1].lessThan(node1 & CLR, node2 & CLR)
  +                            : dom1 < dom2;
       }
       
       public void characters(final int textNode, TransletOutputHandler handler)
  -	throws TransletException {
  -	    _adapters[getDTMId(textNode)].characters(textNode & CLR, handler);
  +                 throws TransletException
  +    {
  +        _adapters[getDTMId(textNode)].characters(textNode & CLR, handler);
       }
   
       public void setFilter(StripFilter filter) {
  -	for (int dom=0; dom<_free; dom++) {
  -	    _adapters[dom].setFilter(filter);
  -	}
  +        for (int dom=0; dom<_free; dom++) {
  +            _adapters[dom].setFilter(filter);
  +        }
       }
   
       public Node makeNode(int index) {
  -    	if (index == DTM.NULL)
  -    	return null;
  -	return _adapters[getDTMId(index)].makeNode(index & CLR);
  +        if (index == DTM.NULL) {
  +            return null;
  +        }
  +        return _adapters[getDTMId(index)].makeNode(index & CLR);
       }
   
       public Node makeNode(DTMAxisIterator iter) {
  -	// TODO: gather nodes from all DOMs ?
  -	return _adapters[0].makeNode(iter);
  +        // TODO: gather nodes from all DOMs ?
  +        return _adapters[0].makeNode(iter);
       }
   
       public NodeList makeNodeList(int index) {
  -    	if (index == DTM.NULL)
  -    	return null;
  -	return _adapters[getDTMId(index)].makeNodeList(index & CLR);
  +        if (index == DTM.NULL) {
  +            return null;
  +        }
  +        return _adapters[getDTMId(index)].makeNodeList(index & CLR);
       }
   
       public NodeList makeNodeList(DTMIterator iter) {
  -	// TODO: gather nodes from all DOMs ?
  -	return _adapters[0].makeNodeList(iter);
  +        // TODO: gather nodes from all DOMs ?
  +        return _adapters[0].makeNodeList(iter);
       }
   
       public String getLanguage(int node) {
  -	return _adapters[getDTMId(node)].getLanguage(node & CLR);
  +        return _adapters[getDTMId(node)].getLanguage(node & CLR);
       }
   
       public int getSize() {
  -	int size = 0;
  -	for (int i=0; i<_size; i++)
  -	    size += _adapters[i].getSize();
  -	return(size);
  +        int size = 0;
  +        for (int i=0; i<_size; i++) {
  +            size += _adapters[i].getSize();
  +        }
  +        return(size);
       }
   
       public String getDocumentURI(int node) {
  -    	if (node == DTM.NULL)
  -    	node = DOM.NULL;
  -	return _adapters[getDTMId(node)].getDocumentURI(0);
  +        if (node == DTM.NULL) {
  +            node = DOM.NULL;
  +        }
  +        return _adapters[getDTMId(node)].getDocumentURI(0);
       }
   
       public boolean isElement(final int node) {
  -    	if (node == DTM.NULL)
  -    	return false;
  -	return(_adapters[getDTMId(node)].isElement(node & CLR));
  +        if (node == DTM.NULL) {
  +            return false;
  +        }
  +        return(_adapters[getDTMId(node)].isElement(node & CLR));
       }
   
       public boolean isAttribute(final int node) {
  -    	if (node == DTM.NULL)
  -    	return false;
  -//    	getNodeIdent(node)>>>24
  -	return(_adapters[getDTMId(node)].isAttribute(node & CLR));
  +        if (node == DTM.NULL) {
  +            return false;
  +        }
  +        return(_adapters[getDTMId(node)].isAttribute(node & CLR));
       }
       
       public int getDTMId(int nodeHandle)
       {
  -    	DTMManager dtmManager = ((DTMDefaultBase)((DOMAdapter)_adapters[0]).getDOMImpl()).m_mgr;
  -    	int id = dtmManager.getDTMIdentity(dtmManager.getDTM(nodeHandle)) >>> DTMManager.IDENT_DTM_NODE_BITS;
  -    	return (id == -1 ? 0 : id);
  +        DTMManager dtmManager =
  +              ((DTMDefaultBase)((DOMAdapter)_adapters[0]).getDOMImpl()).m_mgr;
  +        int id = dtmManager.getDTMIdentity(dtmManager.getDTM(nodeHandle))
  +                       >>> DTMManager.IDENT_DTM_NODE_BITS;
  +        return (id == -1 ? 0 : id);
       }
       
       public int getNodeIdent(int nodeHandle)
       {
  -    	int id = getDTMId(nodeHandle);
  -    	return (_adapters[id].getNodeIdent(nodeHandle) | id<<24);
  +        int id = getDTMId(nodeHandle);
  +        return (_adapters[id].getNodeIdent(nodeHandle) | id<<24);
       }
       
       public int getNodeHandle(int nodeId)
       {
  -    	return _adapters[nodeId>>>24].getNodeHandle(nodeId & CLR);
  +        return _adapters[nodeId>>>24].getNodeHandle(nodeId & CLR);
       }
       
       public DOM getResultTreeFrag()
       {
  -    	return _adapters[0].getResultTreeFrag();
  +        return _adapters[0].getResultTreeFrag();
       }
       
       public DOM getMain()
       {
  -    	return _adapters[0];
  +        return _adapters[0];
       }
       
       /**
  @@ -559,13 +614,13 @@
        */
       public TransletOutputHandler getOutputDomBuilder()
       {
  -    	return _adapters[0].getOutputDomBuilder();
  +        return _adapters[0].getOutputDomBuilder();
       }
   
       public String lookupNamespace(int node, String prefix) 
  -	throws TransletException
  +        throws TransletException
       {
  -	return _adapters[node>>>24].lookupNamespace(node, prefix);
  +        return _adapters[node>>>24].lookupNamespace(node, prefix);
       }
   
       // %HZ% Does this method make any sense here???
  
  
  

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