把第一个DIV和第一个IMG中间的代码删除, 最好使用开源JAR包, 如HTMLCLEANER, HTMLPARSER
不能破坏HTML的规则<div>
<p><br style="padding: 0px; margin: 0px;" /><strong style="font-family: Arial, Verdana, sans-serif; font-size: 13px;"><br /></strong></p><div class="tag81" style="font-family: Arial, Verdana, sans-serif; font-size: 13px; padding: 0px; margin: 0px;"><div class="float-left" style="float: left; padding: 0px; margin: 0px;"> </div><br /><div style="padding: 0px; margin: 0px;"><img src="http://www.1ju.org/avaxhome/2e/fc/001bfc2e_medium.jpeg" border="0" /></div><br /><div style="padding: 0px; margin: 0px;"><strong style="padding: 0px; margin: 0px;">Mark Finn, &quot;Kellogg on China: Strategies for Success&quot;</strong><br />Publisher: Northwestern University Press | 2004 | ISBN: <a>0810122251</a> | PDF | 225 pages | 2.2 MB</div></div><div class="tag81" style="font-family: Arial, Verdana, sans-serif; font-size: 13px; padding: 0px; margin: 0px;"><br />An in-depth look at how to do business in China as it becomes a global economic power Since 1979, when China emerged from its long isolation and launched the first of its economic reforms, the country has gone from producing low-quality exports to making sophisticated high-technology goods and is now a major player in the world economy. China has become the new engine of global growth.<br />As China continues to implement its commitments agreed upon with membership into the World Trade Organization (WTO), the environment for multinational corporations is changing rapidly. This book examines some of the changes WTO accession is bringing to the et environment and different sectors of the economy, and the resulting challenges and opportunities for companies doing business in China. <br />The book draws on extensive field research with Chinese corporate executives, government officials, and representatives of nongovernmental organizations. Based on the findings from these interviews, the authors provide insights and strategies for companies seeking to establish a sustainable competitive advantage in the country&apos;s evolving etplace. Kellogg on China is the outgrowth of a collaborative student-faculty effort through the Global Initiatives in Management program at the Kellogg School of Management.</div><div class="tag81" style="font-family: Arial, Verdana, sans-serif; font-size: 13px; padding: 0px; margin: 0px;">DOWNLOAD:</div><div class="tag81" style="padding: 0px; margin: 0px;"><span style="font-family: Arial, Verdana, sans-serif; font-size: 12px;"><a href="http://www.1ju.org/file/1257103614/0810122251.pdf" rel="nofollow">http://www.1ju.org/file/1257103614/0810122251.pdf</a></span></div><br />
</div>

解决方案 »

  1.   

    既然删除它们之间的代码,那肯定在DOM结构中该div和img是平级的,可以用以下代码String html="xxxx.......xxx";int index1 = html.indexOf("</div>");
    int index2 = html.indexOf("<img>");String newhtml = html.substring(0,index1) + html.substring(index2);
      

  2.   


    <p><br style="padding: 0px; margin: 0px;" /><strong style="font-family: Arial, Verdana, sans-serif; font-size: 13px;"><br /></strong></p><div class="tag81" style="font-family: Arial, Verdana, sans-serif; font-size: 13px; padding: 0px; margin: 0px;"><div class="float-left" style="float: left; padding: 0px; margin: 0px;"> </div><br />
    这段代码怎么删除掉