You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2002/09/30 18:53:20 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref DTMManagerDefault.java

jkesselm    2002/09/30 09:53:20

  Modified:    java/src/org/apache/xml/dtm/dom2dtm2 Tag: xslt20
                        NodeDTMIDResolver_xerces.java
               java/src/org/apache/xml/dtm/ref Tag: xslt20
                        DTMManagerDefault.java
  Log:
  Better fix for the DOM node-ordering code, tracking change made
  to Xerces' version. We should actually be invoking the Xerces
  code, but we can't cut over to the latest Xerces until we've updated
  to reflect changes in XNI.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +26 -20    xml-xalan/java/src/org/apache/xml/dtm/dom2dtm2/Attic/NodeDTMIDResolver_xerces.java
  
  Index: NodeDTMIDResolver_xerces.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/dom2dtm2/Attic/NodeDTMIDResolver_xerces.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- NodeDTMIDResolver_xerces.java	27 Sep 2002 22:07:03 -0000	1.1.2.1
  +++ NodeDTMIDResolver_xerces.java	30 Sep 2002 16:53:20 -0000	1.1.2.2
  @@ -685,12 +685,7 @@
    
           // Note:  the following 2 loops are quite close to the ones above.
           // May want to common them up.  LM.
  -        //
  -        // ISSUE: If either was an attr node, the switch to the Element may
  -        // put it in the OTHER's ancestry. We need to rescan *both*
  -        //
  -        /* -- *///if (thisAncestorType == Node.ATTRIBUTE_NODE) {
  -        /* ++ */if (thisAncestorType == Node.ATTRIBUTE_NODE || otherAncestorType==Node.ATTRIBUTE_NODE) {
  +        if (thisAncestorType == Node.ATTRIBUTE_NODE) {
               thisDepth=0;
               for (node=thisNode; node != null; node=node.getParentNode()) {
                   thisDepth +=1;
  @@ -699,11 +694,11 @@
                     return NodeImpl.TREE_POSITION_PRECEDING;
                   thisAncestor = node;
               }
  -        /* -- *///}
  +		}
   
  -        /* -- */// Now, find the ancestor of the owning element, if the original
  -        /* -- */// ancestor was an attribute
  -        /* -- *///if (otherAncestorType == Node.ATTRIBUTE_NODE) {
  +        // Now, find the ancestor of the owning element, if the original
  +        // ancestor was an attribute
  +        if (otherAncestorType == Node.ATTRIBUTE_NODE) {
               otherDepth=0;
               for (node=otherNode; node != null; node=node.getParentNode()) {
                   otherDepth +=1;
  @@ -720,16 +715,27 @@
           if (thisAncestor != otherAncestor) 
             return NodeImpl.TREE_POSITION_DISCONNECTED; 
   
  -        // Determine which node is of the greatest depth.  
  -        if (thisDepth > otherDepth) {
  -          for (int i=0; i<thisDepth - otherDepth; i++)
  -            thisNode = thisNode.getParentNode();
  -        }
  -        else {
  -          for (int i=0; i<otherDepth - thisDepth; i++)
  -            otherNode = otherNode.getParentNode();
  -        }
  -          
  +		// Go up the parent chain of the deeper node, until we find a node
  +		// with the same depth as the shallower node
  +		if (thisDepth > otherDepth) {
  +			for (int i=0; i<thisDepth - otherDepth; i++)
  +            	thisNode = thisNode.getParentNode();
  +			// Check if the node we have reached is in fact "otherNode". 
  +			// This can happen in the case of attributes.  In this case, 
  +			// otherNode "precedes" this.
  +			if (thisNode == otherNode)
  +				return NodeImpl.TREE_POSITION_PRECEDING;
  +		}
  +		else {
  +			for (int i=0; i<otherDepth - thisDepth; i++)
  +				otherNode = otherNode.getParentNode();
  +			// Check if the node we have reached is in fact "thisNode".  This can
  +			// happen in the case of attributes.  In this case, otherNode
  +			// "follows" this.
  +			if (otherNode == thisNode)
  +				return NodeImpl.TREE_POSITION_FOLLOWING;
  +		}
  +		
           // We now have nodes at the same depth in the tree.  Find a common 
           // ancestor.                                   
           Node thisNodeP, otherNodeP;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.41.6.1.2.3 +1 -1      xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java
  
  Index: DTMManagerDefault.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java,v
  retrieving revision 1.41.6.1.2.2
  retrieving revision 1.41.6.1.2.3
  diff -u -r1.41.6.1.2.2 -r1.41.6.1.2.3
  --- DTMManagerDefault.java	30 Sep 2002 15:33:22 -0000	1.41.6.1.2.2
  +++ DTMManagerDefault.java	30 Sep 2002 16:53:20 -0000	1.41.6.1.2.3
  @@ -126,7 +126,7 @@
     // Set true to attempt loading DOMs via our experimental
     // DOM2DTM2 wrapper. If false, or if that fails, we fall
     // back on standard DOM2DTM.
  -  private static final boolean ATTEMPT_DOM2DTM2=false;	
  +  private static final boolean ATTEMPT_DOM2DTM2=true;	
   	
   	
     /** Set this to true if you want a dump of the DTM after creation. */
  
  
  

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