how to display xml in javascript?

后端 未结 7 1024
春和景丽
春和景丽 2020-12-09 00:29

As the question says, it just escaped my memory how to display xml in javascript, I want to display some source xml within an div on a page, that sits next to the processed

7条回答
  •  独厮守ぢ
    2020-12-09 01:13

    The problem is that you have to escape the characters that the HTML parser will interpret as markup: <, >, &, and in some cases " and '

    Core JavaScript doesn't provide this for you, but many of the add-on libraries do.

    For example, Prototype has: http://www.prototypejs.org/api/string/escapeHTML

提交回复
热议问题