2

我有一个 XML 文件,它在 XML 子标签中包含一些 Anchor(A HREFs) 标签......当我使用 JQuery 加载内容并生成动态 HTML 元素时,链接不会出现。

示例 XML 标记:

<question>
    <number>12</number>
    <qts>How can I download the mobile app?</qts>
    <ans>Please login to the site – <a href="https://google.com">https://google.com</a> from your desktop/laptop. Go to the subscribe page and download the file that is appropriate for you.</ans> 
</question>

jQuery标签加载:

xml_ans = $(this).find('ans').text();

问题是https://google.com没有显示为链接。

任何人都可以对它提出一些启示或提示吗?

4

1 回答 1

4

<![CDATA[ ]]>用;将 HTML 包装在 XML 中

<question>
        <number>12</number>
        <qts>How can I download the mobile app?</qts>
        <ans>
                <![CDATA[
                    Please login to the site – <a href="https://google.com">https://google.com</a> from your desktop/laptop. Go to the subscribe page and download the file that is appropriate for you.
                ]]>
        </ans>  
</question>

http://en.wikipedia.org/wiki/CDATA

于 2012-11-26T11:24:54.213 回答