W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re: making Elements from strings

From: <keshlam@us.ibm.com>
Date: Tue, 22 Aug 2000 11:34:57 -0400
To: David Pickles <david.pickles@knowhowsystems.com>
cc: www-dom@w3.org
Message-ID: <85256943.0055977F.00@D51MTA03.pok.ibm.com>
>Is there a way of taking a string which is an XML element (perhaps with
>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

Joe Kesselman  / IBM Research
Received on Tuesday, 22 August 2000 11:35:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC