You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by js...@apache.org on 2001/07/26 18:46:45 UTC

cvs commit: jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath AddTag.java

jstrachan    01/07/26 09:46:45

  Modified:    xtags/src/org/apache/taglibs/xtags/xpath AddTag.java
  Log:
  Fixed mistake in addition logic - this patch was submitted by James Elson
  
  Revision  Changes    Path
  1.2       +7 -2      jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath/AddTag.java
  
  Index: AddTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath/AddTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AddTag.java	2001/07/24 13:44:22	1.1
  +++ AddTag.java	2001/07/26 16:46:45	1.2
  @@ -68,6 +68,7 @@
   import org.dom4j.DocumentFactory;
   import org.dom4j.DocumentException;
   import org.dom4j.Element;
  +import org.dom4j.Node;
   import org.dom4j.XPath;
   import org.dom4j.io.SAXReader;
   
  @@ -100,8 +101,12 @@
                   SAXReader reader = new SAXReader();
                   Document doc = reader.read(sreader);
                   Element root = doc.getRootElement();
  -                root.detach();                
  -                ((Element)element).add( root );
  +                List nodes = root.content();
  +                while (! nodes.isEmpty() ) {
  +                    Node node = (Node)nodes.remove(0);
  +                    node.detach();
  +                    ((Element)element).add( node );
  +                }
               } 
               catch (DocumentException e) { 
                   handleException(e);