javascript parsing HTML from XML

M

manu3d

Hi all,

I have an XML file that among other things has the following node.
As you can see it contains HTML tags.

<description lang="en">
<![CDATA[
<div class="descrBoxRight" style=" top:250; left:200">
ENGLISH <b>ENGLISH</b> ENGLISH ENGLISH
</div>
]]>
</description>

With javascript, in Mozilla, I easily retrieve the content of the
XML "description" tag using the following line of code

var myStuff = myDescrNode.textContent;

However, in IE (6.0)

var myHTML = myDescrNode.textContent;

and

var myHTML = myDescrNode.innerText;

do not work, resulting in myHTML being undefined.

Alternative solutions? Should I remove the CDATA tag
and use a completely different method?

Thanks for your help.

Manu
 
M

Martin Honnen

var myStuff = myDescrNode.textContent;

However, in IE (6.0)

var myHTML = myDescrNode.textContent;

IE uses MSXML where you need to use
myDescrNode.text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top