sboag       01/07/03 08:47:25

  Modified:    java/src/org/apache/xml/dtm/ref DTMManagerDefault.java
  Log:
  Since the real root of our tree may be a DocumentFragment, we need to
  use getParent to find the root, instead of getOwnerDocument.  Otherwise
  DOM2DTM#getHandleOfNode will be very unhappy.
  Result of report via private mail by Carsten Ziegeler of breakage
  in Cocoon.
  
  Revision  Changes    Path
  1.16      +9 -7      
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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DTMManagerDefault.java    2001/06/29 17:39:39     1.15
  +++ DTMManagerDefault.java    2001/07/03 15:47:18     1.16
  @@ -454,13 +454,15 @@
             }
            }
         
  -      // Fallback: Not found in one we know how to search.
  -      // Current solution: Generate a new DOM2DTM.
  -      // %REVIEW% Maybe the best I can do??     
  -      Node root = (Node.DOCUMENT_FRAGMENT_NODE == node.getNodeType()) ?
  -                  node : node.getOwnerDocument();
  -      if(null == root)
  -        root =  node;   
  +      // Since the real root of our tree may be a DocumentFragment, we need 
to 
  +      // use getParent to find the root, instead of getOwnerDocument.  
Otherwise 
  +      // DOM2DTM#getHandleOfNode will be very unhappy.
  +      Node root = node;
  +      for (Node p = root.getParentNode(); p != null; p = p.getParentNode()) 
  +      {
  +        root = p;
  +      }
  +        
         DTM dtm = getDTM(new javax.xml.transform.dom.DOMSource(root), false,
                          null, true, true);
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to