Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000236 [Resin] minor always 06-06-05 00:00 11-30-05 14:43
Reporter ferg View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 3.0.13
Summary 0000236: QDocument
Description RSN-259
(rep by James Howe)

I just wrote some code to replace a node inside of an DOM tree based on this article: [^] When I stepped through the code, the resulting XML document was not what I expected to see. When using importNode with a DocumentFragment, the Resin code does not import the nodes from the document fragment. The method in question is this one in com.caucho.xml.QDocument:

   * Imports an element.
  private DocumentFragment importFragment(DocumentFragment elt, boolean deep)
    QDocumentFragment newFrag = new QDocumentFragment();

    newFrag._owner = this;

    if (! deep)
      return newFrag;

    for (Node node = getFirstChild();
     node != null;
     node = node.getNextSibling()) {
      newFrag.appendChild(importNode(node, true));

    return newFrag;

The problem, I believe is the for loop should be doing "for (Node node = elt.getFirstChild(); ..." instead of "for (Node node = getFirstChild(); ...". The way things are currently written, the importFragment code just gets elements from the owner document, not the elements from the document fragment being imported. It happens that I'm currently using Resin 3.0.8, but the source code above was taken from 3.0.12 (I haven't downloaded a later version). If it's been fixed, great. If I'm misunderstanding something, please let me know, but the code as written above doesn't make any sense if you are trying to import nodes from the document fragment into the owning document.

Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
06-06-05 00:00 ferg New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.14
11-30-05 14:43 ferg Status resolved => closed

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker