1

根据我访问的博客文章,我需要一个 uiwebview 来填充一个 div 类的 html。每次都是同一个html的div类,名字不变,只是内容。

div 类被称为:

<div class="field-item even" property="content:encoded">

内容如下所示:

    <div class="field-items"><div class="field-item even" property="content:encoded"><p>Data centre security is a big issue – especially for co-location centres hosting multiple racks for multiple, often competing, clients. Yet whilst security to access the data centre can often be impressive, individual rack level security is often inadequate. Given the number of in-house staff and external engineers, from cablers to storage and server providers, traipsing through a data centre on a near daily basis, poor rack level security is a potential risk.</p>
<p>According to a recent survey conducted by Lieberman Software, 42 percent of IT staff can get unauthorised access to their organisation’s most sensitive information – including the CEO’s private documents. The failing is blamed on management’s naivety when it comes to understanding just how much privileged access their IT departments actually have.</p>
<p>The fact that most racks are secured only with standard handles using a manual key, bears out this survey. Easily broken or bypassed, these locks provide minimal corporate protection; they offer no access control or audit trail of activity. Given the huge ongoing investment in data centres - during 2011-2012, the UK invested an estimated $3.35 billion in data centres; the second highest spending of any country, according to the Datacentre Dynamics Global Industry Census 2011 - extending standard access control techniques to the data centre racks is an important step.</p>
<p>Companies can opt for a rack specific key, combination locks or key cards that are IP enabled to allow an organisation to impose strict control over the time/day an individual is allowed to access the rack. Using standard access control software, all activity is recorded and audited, providing the organisation with a complete list of those who have accessed the racks.</p>
<p>For organisations, this approach adds control and addresses one important aspect of the internal threat. For co-location sites, rack level security removes the need to cage off client specific rack space areas freeing up space that can be used for more racks, delivering a return on investment, as well as improved client security.</p>
</div>

该页面可以在这里找到。

我需要一种方法来仅从页面 url 获取该 div 中的 html,保留样式并将其放入字符串中,然后填充 uiwebview,有人可以帮我吗?

谢谢。

更好的代码场景:

基本上,我从博客文章的 rss 提要中填充了一个合适的视图。这工作正常。单击博客文章会返回单击的博客文章的 url,作为要使用的字符串。它从这里开始,我不明白如何将此字符串加载到 web 视图中,然后在该 web 视图上使用 jquery 仅在一个 div 类中显示所有内容(如上所述。)

4

1 回答 1

0

您可以将页面上的所有内容加载到 webview 中,然后运行一些 javascript 来隐藏除 div 及其内容之外的所有内容。这个stackoverflow问题(嗯,真的,答案)看起来可以帮助你完成这个。如果页面不大,这可能是要走的路,因为样式会被保留为一个很好的副作用。

于 2012-10-23T02:33:30.880 回答