javascript parsing HTML from XML

Discussion in 'Javascript' started by manu3d@gmail.com, Jul 20, 2006.

  1. Guest

    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
     
    , Jul 20, 2006
    #1
    1. Advertising

  2. wrote:


    > var myStuff = myDescrNode.textContent;
    >
    > However, in IE (6.0)
    >
    > var myHTML = myDescrNode.textContent;


    IE uses MSXML where you need to use
    myDescrNode.text
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jul 20, 2006
    #2
    1. Advertising

  3. Guest

    Martin Honnen wrote:
    > IE uses MSXML where you need to use
    > myDescrNode.text


    Thank you Martin.

    Manu
     
    , Jul 20, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Levine
    Replies:
    0
    Views:
    732
    John Levine
    Feb 2, 2012
  2. Erik Wasser
    Replies:
    5
    Views:
    463
    Peter J. Holzer
    Mar 5, 2006
  3. Replies:
    7
    Views:
    1,379
  4. Ninja Li

    Parsing HTML with HTML::TableExtract

    Ninja Li, Nov 27, 2009, in forum: Perl Misc
    Replies:
    2
    Views:
    228
    Martien Verbruggen
    Nov 28, 2009
  5. Ninja Li

    Parsing HTML with HTML::Tree

    Ninja Li, Mar 1, 2010, in forum: Perl Misc
    Replies:
    1
    Views:
    150
    Ninja Li
    Mar 1, 2010
Loading...

Share This Page