Re: Ad Hoc Element Creation

>  The current version of the Oracle parser allows an Element to be created
without reference to any document:

Not supported by the DOM, sorry. The closest approximation is indeed
Document.createElement() or Document.createElementNS(). If you already have
a Document object you can use it; if not, or if you want a new Document,
see the DOMImplementation.createDocument() method... which also deals with
creating a root element, so that's simpler than your sample refactoring.

The reason behind Nodes (not just Elements) belonging to a specific
Document: Different Documents may be in different DOM implementations (or
different subclasses of a single implementation), and may have internal
behaviors which aren't completely compatable with no des from other
Documents. The question of mixing nodes across implementations is being
studied (as the "embedded DOM" concept) but is far from being a solved
problem.

______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 5 February 2001 17:22:06 UTC