Re: Question about createTextNode in xml files
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Question about createTextNode in xml files

From: Andy Dingley <dingbat@codesmiths.com>
Date: Thu Jun 16 2005 - 03:27:04 CEST

On 15 Jun 2005 16:51:56 -0700, "DKM" <debashishkmishra@hotmail.com>
wrote:

>Any idea as to how one can dynamically insert a long and compleex html
>formated string into the document?

A "compleex html formated string" might be HTML, but that doesn't mean
it's a well-formed XML fragment. Your string _must_ also be a balanced
well-formed XML fragment to work with it like this - if it's coming from
an external source, you might not be able to guarantee this (this is a
problem for HTML-transporting XML protocols like RSS)

To try and solve your immediate problem though, create a new, empty XML
document as an object in your script, then use the .load() method to
load and parse the string you have (yes, it's a slow parsing operation -
no way to avoid it). Then copy this new fragment into the main DOM
document.
Received on Tue Oct 18 02:45:02 2005