Re: making Elements from strings

>Is there a way of taking a string which is an XML element (perhaps with
many
>other elements nested within it), and directly creating from it an Element
>belonging to an already existing Document?

Some parsers may provide a custom mechanism of this sort, but at this time
there is no portable solution defined by the  DOM API. DOM Level 3's
load/save features may be able to address this.

My usual recommendation is to set up a SAX listener which builds nodes
within the existing document, and use a SAX parser to drive it. This isn't
a complete solution -- there are a few impedence mismatches between SAX and
DOM -- but it works well enough for most purposes and should be fairly
portable.



______________________________________
Joe Kesselman  / IBM Research

Received on Tuesday, 22 August 2000 11:35:34 UTC