using XMLDOMNode text attribute to store HTML

Hi,
Before asking my question, I fully understand that it is not a good idea to have to store HTML into an XML document as XSL should be responsible for presentation.

However, I would like to actually use the MS DomNode text property to store some HTML data.

eg.

x.text = “Hello World!”

The problem is, the text is then stored instead
as < with lt and > with gt

How do i go about saving the HTML into the node ‘as is’ (without the < and > changing into lt and gt)?

[This message was edited by eazy on 03 Sep 2001 at 06:03.]

[This message was edited by eazy on 03 Sep 2001 at 06:04.]

The property text of MS XMLDOMNode represents the contents of text or CDATA nodes. If you write something there it must be text and cannot contain markup. This is a rule of XML.

You can try CDATA section to avoid this.

x.appendChild(x.ownerDocument.createCDATASection(“Hello World!”))

In this case you can use x.text to read HTML code back and it will not be encoded.

If you want that your HTML code appears as XML elements you should convert it to XHTML and create manually. Then you can use xml property to read data.