我的XML文件中有这个html标签
<text><![CDATA[<p><div style="text-align:justify">A certain compound has the molecular formula <img width="40" height="17" align="bottom" alt="mc001-2.jpg" src="@@PLUGINFILE@@/mc001-2.jpg" border="0"> If 10.0 g of the compound contains 5.62 g of X, the atomic mass of X is</div></p>]]></text>
和src属性包含文件名,如果在我的XML文件中的另一个文件标签中,则在下面给出..
<file name="mc001-2.jpg" encoding="base64"> /9j/4AAQSkZJRgABAAEAIwAUAAD//gAfTEVBRCBUZWNobm9sb2dpZXMgSW5jLiBWMS4wMQD/2wCE
AAICAgICAgICAgICAgICAgICAgICAgICAgICAwMDAwMDAwMDBA UEAwQFBAMDBAYEBQUFBgYGAwQG
BwYGBwUGBgUBAgICAgICAgICAgUDAwMFBQUFBQUFBQUFBQUFBQ UFBQUFBQUFBQUFBQUFBQUFBQUF
BQUFBQUFBQUFBQUFBQUFBf/EAaIAAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKCwEAAwEBA QEB
AQEBAQAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX 0BAgMABBEFEiExQQYTUWEHInEU
MoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OT pDREVGR0hJSlNUVVZXWFlaY2Rl
ZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqK mqsrO0tba3uLm6wsPExcbHyMnK
0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+foRAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYS
QVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJi coKSo1Njc4OTpDREVGR0hJSlNU
VVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5 iZmqKjpKWmp6ipqrKztLW2t7i5
usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/AABEIABAACwMBEQACEQEDEQH/
2gAMAwEAAhEDEQA/AP2M8S/Gm08Ba5f+HfG2g39nqWo3Gz4YQ6Jv1hvig7ou3SdMBSIQa1E+8 z2M
zKiWym9E7W8V09pNH2lem6VCnz4yDlzUbqP7vmfLXU3p9XjHlV eo0nh6l4zjy1MPOvcoxpTVSrNU
8I1H987tQnyrmpTjFOXtJSv9XhFSeIi1GnerGpTh6x4fn1u60X TbnxHp1lpGuT2sc2p6Xp2oPqtn
p1y/zG3jvHhhNzsBCmTy0DMGIGME7VIwhPkp1OdRSXNZpOVlzOKeqj zX5ea0uW3Mk7pYwlKScnTc
LuXLFtcyjzPk5+VuKnycvOoylFTuoylFKT801v4LeHvF+ra9rf ji7vPEmp3gW18KXCltKf4cadE8
M8B8NvA5ew1H7TBFdy6srfaJZIoVysMMUKYU4zoU1KjVdPFc7m 68bc+jkqcIqSlFUYwk4TotSp1+
ao66qRnyR2qTVVxp1KalhoxS9i78km4pTqVGmnKo5X9nNOMsPD lVDkqe0q1fTdBstS03RtNsNY1h
9f1OytIra81uWyt9On1SWMbftMtvb/uYpXADOIwqFixVEUhF3qzjUm5xpKne14xvyp2XNyqTlJR5
ruMXKTjG0XKTXM8KUHSh7N1HNRbs5W5uW75VJpJSko2UpKMVJp y5Y35V/9k=
</file>
我在CDATA类型节点之间解析xml文件后得到了文本或者说String,但当我在WebView中加载它时,它会为
创建一个框<img width="40" height="17" align="bottom" alt="mc001-2.jpg" src="@@PLUGINFILE@@/mc001-2.jpg" border="0">
我的问题是如何使用src属性在webView中加载上面的图像标记????????? 我也对src属性中给出的路径感到困惑。
截图就像这样
任何帮助都将受到高度赞赏。在此先感谢
答案 0 :(得分:2)
这看起来像是代表图像的Base64编码字符串。
要在WebView中加载此类图像,请查看此文章。
<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD" />
答案 1 :(得分:0)
我已经解决了我的问题,我已经替换了我的src属性
src="@@PLUGINFILE@@/mc001-2.jpg" by this
src='data:image/png;base64,<!- Base64 code for image -->'
并轻松解析
它对我有用感谢回复。