【问题标题】:I wanted to show an XML tag <Cat_Desc> in a web View but it is having HTML tags also我想在 web 视图中显示一个 XML 标签 <Cat_Desc> 但它也有 HTML 标签
【发布时间】:2011-12-10 16:45:09
【问题描述】:

我必须从 xml 解析数据。这是我的 xml- 或者它的 url 是:http://mobileecommerce.site247365.com/admin/catdata.xml

  <Cat_Name>News for the day</Cat_Name>
    <Cat_Desc>
    <div style="text-align: center;"><span class="Apple-style-span" style="font-weight: normal; font-size: medium; "><img src="http://mobileecommerce.site247365.com/admin/assetmanager/images/gns_header.jpg" alt="" align="middle" border="1px" height="90" width="550"></span></div><span class="Apple-style-span" style="color: rgb(105, 105, 105); font-family: Verdana; font-size: 13px; font-weight: normal; "><br><div style="text-align: center;">Yes we are coming at E & I? Are you?</div></span><br><h1 style="font-weight: bold; "><span style="font-family: Verdana; font-size: 14pt; ">News for the day...</span></h1><span style="color: rgb(105, 105, 105); "><span style="font-family: Tahoma; font-size: 10pt; ">Template Mobile Sites for IC: <a href="http://icmobilesite.vidushiinfotech.net/">http://icmobilesite.vidushiinfotech.net/</a></span><br><span class="Apple-style-span" style="font-family: Tahoma; font-size: 13px; color: rgb(105, 105, 105); ">Promotional valid till 30 Sept 2011: MOBILE WEBSITE (Base Product Mobile CMS) for JUST $159<br></span></span><br><span style="font-family: Tahoma; font-size: 10pt; color: rgb(105, 105, 105); ">Mobile Template link: </span><a href="http://newsletter.vidushiinfotech.net/Mobilesite/"><span class="Apple-style-span" style="font-size: 15px; font-family: Calibri, sans-serif; color: rgb(105, 105, 105); ">http://newsletter.vidushiinfotech.net/Mobilesite/</span><br></a><span style="font-size: 10pt; font-family: Tahoma; "><span style="font-size: 10pt; "><br><span style="color: rgb(105, 105, 105); ">With the promotion on Business Edge and eFusion still running successful in e market place - $ 499</span><br><span style="color: rgb(105, 105, 105); ">Check out some of the latest site launch on: </span><br><br><span style="color: rgb(105, 105, 105); font-weight: bold; ">http://www.randallcontracting.co.uk/Pages/Default.aspx </span><br><br><span style="color: rgb(105, 105, 105); font-size: 10pt; "><span style="font-weight: bold; ">Category</span>: Building & Construction</span><br></span><br></span><div style="color: rgb(105, 105, 105); text-align: left; "><span style="font-size: 10pt; font-family: Tahoma; ">Description: WELCOME TO RANDALL CONTRACTING Randall Contracting is a family-run contracting SME which has been servicing London and the South East since 1956. Working closely with our Clients and external Design Consultants, we place great emphasis on a safe, positive, practical and common sense approach to our projects. Our delivery methods have resulted in an extensive volume of repeat business from both Private and Public Sectors. Safety and Environmental concerns are a high priority on all our contracts and we continually strive to source innovative working methods and solutions. Our equipment is regularly updated and maintained to ensure minimal environmental impact.</span><br><br></div><span style="color: rgb(105, 105, 105); font-weight: bold; font-family: Tahoma; "><span style="font-size: 10pt; "><br></span></span><br>
        </Cat_Desc>

我为第一个 cat_name 添加了一个 snap。在 webview 或 android 中的任何其他视图中上传整个 cat_description 的任何方式,或者我需要一个一个解析并一个一个显示。

这张图片有标签数据

任何帮助将不胜感激。提前致谢

【问题讨论】:

    标签: android html-parsing xml-parsing android-webview


    【解决方案1】:

    伙计们,我得到了答案,我们只需将 整个 XML(带有 HTML 标记) 保存在 String 中,然后将该字符串传递给网络视图。它将显示您的所有数据。这是因为 WebViews 只理解 HTML 或 XML,所以当我们将我们的 HTML 字符串以 XML 格式传递给它们时。它可以理解并按照我们想要的方式显示我们的内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      • 1970-01-01
      • 2021-12-23
      • 1970-01-01
      • 2011-09-28
      相关资源
      最近更新 更多