if( child.hasBaseMatch() ) {  AttributesImpl copyAtts = new AttributesImpl(); copyAtts.addAttribute("","","src","CDATA",getId(child.getBaseMatch())); copyAtts.addAttribute("","","dst","CDATA",dst); ch.startElement("","",DIFF_NS+"copy",copyAtts); copy( child.getBaseMatch(), child, ch ); ch.endElement("","",DIFF_NS+"copy"); } else {
if (child.hasBaseMatch()) { Vector childStopNodes = new Vector(); m.getAreaStopNodes(childStopNodes, child); int src = getDiffId(child.getBaseMatch()); if (childStopNodes.size() == 0 && !lastStopNode) { if (s.isEmpty()) { s.init(src, dst); continue; } else if (s.appends(src, dst)) { s.append(); continue; } }  if (!s.appends(src, dst)) {   if (!s.isEmpty()) { openCopy(s.src, s.dst, s.run, ch); closeCopy(ch); } if (childStopNodes.size() > 0 || lastStopNode) { openCopy(src, dst, 1, ch); copy(child.getBaseMatch(), child, ch, childStopNodes); closeCopy(ch); s.setEmpty(); } else s.init(src, dst); } else { s.append(); openCopy(s.src, s.dst, s.run, ch); copy(child.getBaseMatch(), child, ch, childStopNodes); closeCopy(ch); s.setEmpty(); }  } else { if (!s.isEmpty()) { openCopy(s.src, s.dst, s.run, ch); closeCopy(ch); s.setEmpty(); }
  protected void copy( BaseNode b, BranchNode branch, ContentHandler ch )                        throws SAXException {    // Find stopnodes    Vector stopNodes = new Vector();    // DEBUG/*    java.io.PrintWriter dw = new java.io.PrintWriter(System.err);    branch.debugTree(dw,0);dw.flush();*/        //ENDDEBUG    m.getAreaStopNodes( stopNodes, branch );    for( Iterator i = stopNodes.iterator();i.hasNext();) {      BranchNode stopNode = (BranchNode) i.next();      String dst = getId(stopNode.getBaseMatch());      // BUGFIX 030115      if( stopNode.getChildCount()==0) {        AttributesImpl copyAtts = new AttributesImpl();        copyAtts.addAttribute("","","dst","CDATA",dst);        ch.startElement("","",DIFF_NS+"insert",copyAtts);        ch.endElement("","",DIFF_NS+"insert");      }      // ENDBUGFIX      for( int ic = 0;ic < stopNode.getChildCount();ic++) {        BranchNode child = stopNode.getChild(ic);        if( child.hasBaseMatch() ) {          // Copy tree...          AttributesImpl copyAtts = new AttributesImpl();          copyAtts.addAttribute("","","src","CDATA",getId(child.getBaseMatch()));          copyAtts.addAttribute("","","dst","CDATA",dst);          ch.startElement("","",DIFF_NS+"copy",copyAtts);          copy( child.getBaseMatch(), child, ch );          ch.endElement("","",DIFF_NS+"copy");        } else {          // Insert tree...          AttributesImpl copyAtts = new AttributesImpl();          copyAtts.addAttribute("","","dst","CDATA",dst);          ch.startElement("","",DIFF_NS+"insert",copyAtts);          insert( child, ch );          ch.endElement("","",DIFF_NS+"insert");        }      } // endfor children    }  }