0

So from what I understand of the CDATA tags on an XML document, it's meant to allow HTML tags inside it to function as they normally would. I am working with a website template here that uses XML files, and while editing one of the documents to add a href or image to it, I rather get a string. Here's the code, if you can help me that would be greatly appreciated.

I have tried modifying the code to use the < / > that it seems to want to suggest in the output text, but that doesn't help either. If anybody can explain or link me to relevant information, or both, it would be amazing =)

    <?xml version="1.0"?>
    <xmldata section="Address">
<content>
<image src="resources/images/streetmap1.png" />

<bodytext><![CDATA[Shop 6, 106 Foster Street
     Dandenong, 3175

     Street Map:
     <image src="resources/images/streetmap1.png" />




]]></bodytext>
</content>  
    </xmldata>

EDIT - Supplying accompanying .js file.

http://pastebin.com/Td2EYiKH

4

1 回答 1

0

因此,根据我对 XML 文档上的 CDATA 标记的理解,它意味着允许其中的 HTML 标记正常运行。

不,这样可以将 XML 中具有特殊含义的字符(例如<作为数据包含在不转义的情况下。

这是代码

您需要查看将 XML 数据转换为 HTML 内容的代码。你还没有和我们分享。

<image src="resources/images/streetmap1.png" />

HTML 元素img不是image,它应该有一个alt属性。

于 2012-07-19T14:39:50.137 回答