Altova Mailing List Archives


Re: Why do elements appear to get "moved" between doms

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 7/19/2006 1:00:00 PM


"Thomas Malia" <tommalia@w...> wrote in message
news:OahTSxpqGHA.4508@T......
> Using the code below, the process of appending elements from DOM 'd' to
DOM
> 'd2' appears to acutally Move them from one dom to the other.  Is this the
> correct behavior for for this process?  If so, why?
>

All msxml nodes in an apartment are managed as a single heap.  The tree
graphing ownership of the nodes will contain documents at the root.  It is a
reasonably easy thing to re-parent a node that is currently owned by one
document into another since they are technically all in the same space.
Whether this is 'correct' is debatable but in terms of standards no it
isn't.

If you tried to do this with other implementations you are likely to get an
error.  Even if you tried to do it with cloneNode() you'd still get an
error.  The standard view is that nodes belong to a document space and that
each document has it's own space or 'heap' of nodes.  You would need to use
importNode() to move the node from one document to the other.

MSXML6 has added the importNode() function so that code written for standard
DOM should work.

Anthony.


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.