javascript parsing HTML from XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bomb23
    New Member
    • Nov 2013
    • 2

    javascript parsing HTML from XML

    Hi all,

    I have a XML file that among other things has the following node.
    As you can see it contains HTML tags.
    I want to append content of "page" tag into my html document.

    Code:
    <?xml version=""1.0"" encoding=""utf-8"" ?>
    <root>
    <page>
    <div class='clk'>
    <a href='...'>1</a>
    <a href='...'>2</a>
    <a href='...'>3</a>
    <a href='...'>4</a>
    .
    .
    .
    </div>
    </page>
    </root>
    With javascript, in Mozilla, I easily retrieve the content of the
    XML "page" tag using the following line of code

    var myHtml= xmlDoc.getEleme ntsByTagName('p aging')[0].innerHTML;

    but in chrome and ie and other browser
    do not work, resulting in myHTML being undefined.



    Thanks for your help.
    Last edited by Rabbit; Nov 13 '13, 09:07 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    since innerHTML is not part of any effective standard, you can try the workaround presented on MDN.

    Comment

    Working...